diff --git a/crates/gitea-client/.openapi-generator/FILES b/crates/gitea-client/.openapi-generator/FILES index 2338093..143e91d 100644 --- a/crates/gitea-client/.openapi-generator/FILES +++ b/crates/gitea-client/.openapi-generator/FILES @@ -3,7 +3,21 @@ Cargo.toml README.md docs/AccessToken.md +docs/ActionArtifact.md +docs/ActionArtifactsResponse.md +docs/ActionRunner.md +docs/ActionRunnerLabel.md +docs/ActionRunnersResponse.md +docs/ActionTask.md +docs/ActionTaskResponse.md docs/ActionVariable.md +docs/ActionWorkflow.md +docs/ActionWorkflowJob.md +docs/ActionWorkflowJobsResponse.md +docs/ActionWorkflowResponse.md +docs/ActionWorkflowRun.md +docs/ActionWorkflowRunsResponse.md +docs/ActionWorkflowStep.md docs/Activity.md docs/ActivityPub.md docs/ActivitypubApi.md @@ -13,6 +27,7 @@ docs/AdminApi.md docs/AnnotatedTag.md docs/AnnotatedTagObject.md docs/ApiError.md +docs/ApplyDiffPatchFileOptions.md docs/Attachment.md docs/Badge.md docs/Branch.md @@ -30,8 +45,10 @@ docs/CommitStats.md docs/CommitStatus.md docs/CommitUser.md docs/Compare.md +docs/ContentsExtResponse.md docs/ContentsResponse.md docs/CreateAccessTokenOption.md +docs/CreateActionWorkflowDispatch.md docs/CreateBranchProtectionOption.md docs/CreateBranchRepoOption.md docs/CreateEmailOption.md @@ -55,6 +72,7 @@ docs/CreateReleaseOption.md docs/CreateRepoOption.md docs/CreateStatusOption.md docs/CreateTagOption.md +docs/CreateTagProtectionOption.md docs/CreateTeamOption.md docs/CreateUserOption.md docs/CreateVariableOption.md @@ -78,6 +96,7 @@ docs/EditPullRequestOption.md docs/EditReactionOption.md docs/EditReleaseOption.md docs/EditRepoOption.md +docs/EditTagProtectionOption.md docs/EditTeamOption.md docs/EditUserOption.md docs/Email.md @@ -93,6 +112,7 @@ docs/GeneralAttachmentSettings.md docs/GeneralRepoSettings.md docs/GeneralUiSettings.md docs/GenerateRepoOption.md +docs/GetFilesOptions.md docs/GitBlobResponse.md docs/GitEntry.md docs/GitHook.md @@ -118,9 +138,12 @@ docs/Label.md docs/LabelTemplate.md docs/LicenseTemplateInfo.md docs/LicensesTemplateListEntry.md +docs/LockIssueOption.md docs/MarkdownOption.md docs/MarkupOption.md docs/MergePullRequestOption.md +docs/MergeUpstreamRequest.md +docs/MergeUpstreamResponse.md docs/MigrateRepoOptions.md docs/Milestone.md docs/MiscellaneousApi.md @@ -157,6 +180,8 @@ docs/PushMirror.md docs/Reaction.md docs/Reference.md docs/Release.md +docs/RenameBranchRepoOption.md +docs/RenameOrgOption.md docs/RenameUserOption.md docs/RepoCollaboratorPermission.md docs/RepoCommit.md @@ -173,6 +198,7 @@ docs/SettingsApi.md docs/StopWatch.md docs/SubmitPullReviewOptions.md docs/Tag.md +docs/TagProtection.md docs/Team.md docs/TeamSearch200Response.md docs/TimelineComment.md @@ -180,6 +206,7 @@ docs/TopicName.md docs/TopicResponse.md docs/TrackedTime.md docs/TransferRepoOption.md +docs/UpdateBranchProtectionPriories.md docs/UpdateFileOptions.md docs/UpdateRepoAvatarOption.md docs/UpdateUserAvatarOption.md @@ -211,7 +238,21 @@ src/apis/settings_api.rs src/apis/user_api.rs src/lib.rs src/models/access_token.rs +src/models/action_artifact.rs +src/models/action_artifacts_response.rs +src/models/action_runner.rs +src/models/action_runner_label.rs +src/models/action_runners_response.rs +src/models/action_task.rs +src/models/action_task_response.rs src/models/action_variable.rs +src/models/action_workflow.rs +src/models/action_workflow_job.rs +src/models/action_workflow_jobs_response.rs +src/models/action_workflow_response.rs +src/models/action_workflow_run.rs +src/models/action_workflow_runs_response.rs +src/models/action_workflow_step.rs src/models/activity.rs src/models/activity_pub.rs src/models/add_collaborator_option.rs @@ -219,6 +260,7 @@ src/models/add_time_option.rs src/models/annotated_tag.rs src/models/annotated_tag_object.rs src/models/api_error.rs +src/models/apply_diff_patch_file_options.rs src/models/attachment.rs src/models/badge.rs src/models/branch.rs @@ -236,8 +278,10 @@ src/models/commit_stats.rs src/models/commit_status.rs src/models/commit_user.rs src/models/compare.rs +src/models/contents_ext_response.rs src/models/contents_response.rs src/models/create_access_token_option.rs +src/models/create_action_workflow_dispatch.rs src/models/create_branch_protection_option.rs src/models/create_branch_repo_option.rs src/models/create_email_option.rs @@ -261,6 +305,7 @@ src/models/create_release_option.rs src/models/create_repo_option.rs src/models/create_status_option.rs src/models/create_tag_option.rs +src/models/create_tag_protection_option.rs src/models/create_team_option.rs src/models/create_user_option.rs src/models/create_variable_option.rs @@ -284,6 +329,7 @@ src/models/edit_pull_request_option.rs src/models/edit_reaction_option.rs src/models/edit_release_option.rs src/models/edit_repo_option.rs +src/models/edit_tag_protection_option.rs src/models/edit_team_option.rs src/models/edit_user_option.rs src/models/email.rs @@ -299,6 +345,7 @@ src/models/general_attachment_settings.rs src/models/general_repo_settings.rs src/models/general_ui_settings.rs src/models/generate_repo_option.rs +src/models/get_files_options.rs src/models/git_blob_response.rs src/models/git_entry.rs src/models/git_hook.rs @@ -323,9 +370,12 @@ src/models/label.rs src/models/label_template.rs src/models/license_template_info.rs src/models/licenses_template_list_entry.rs +src/models/lock_issue_option.rs src/models/markdown_option.rs src/models/markup_option.rs src/models/merge_pull_request_option.rs +src/models/merge_upstream_request.rs +src/models/merge_upstream_response.rs src/models/migrate_repo_options.rs src/models/milestone.rs src/models/mod.rs @@ -359,6 +409,8 @@ src/models/push_mirror.rs src/models/reaction.rs src/models/reference.rs src/models/release.rs +src/models/rename_branch_repo_option.rs +src/models/rename_org_option.rs src/models/rename_user_option.rs src/models/repo_collaborator_permission.rs src/models/repo_commit.rs @@ -373,6 +425,7 @@ src/models/server_version.rs src/models/stop_watch.rs src/models/submit_pull_review_options.rs src/models/tag.rs +src/models/tag_protection.rs src/models/team.rs src/models/team_search_200_response.rs src/models/timeline_comment.rs @@ -380,6 +433,7 @@ src/models/topic_name.rs src/models/topic_response.rs src/models/tracked_time.rs src/models/transfer_repo_option.rs +src/models/update_branch_protection_priories.rs src/models/update_file_options.rs src/models/update_repo_avatar_option.rs src/models/update_user_avatar_option.rs diff --git a/crates/gitea-client/.openapi-generator/VERSION b/crates/gitea-client/.openapi-generator/VERSION index 17f2442..0610c66 100644 --- a/crates/gitea-client/.openapi-generator/VERSION +++ b/crates/gitea-client/.openapi-generator/VERSION @@ -1 +1 @@ -7.9.0-SNAPSHOT +7.21.0-SNAPSHOT diff --git a/crates/gitea-client/Cargo.toml b/crates/gitea-client/Cargo.toml index 847099d..da82bcf 100644 --- a/crates/gitea-client/Cargo.toml +++ b/crates/gitea-client/Cargo.toml @@ -1,17 +1,21 @@ [package] name = "gitea-client" -version = "1.22.1" -authors = ["OpenAPI Generator team and contributors", "kjuulh"] +version = "1.25.2" +authors = ["OpenAPI Generator team and contributors"] description = "This documentation describes the Gitea API." -repository = "https://git.front.kjuulh.io/kjuulh/gitea-rs" license = "MIT" edition = "2021" -publish = true [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" -uuid = { version = "^1.8", features = ["serde", "v4"] } -reqwest = { version = "^0.13.0", features = ["json", "multipart"] } +tokio = { version = "^1.46.0", features = ["fs"] } +tokio-util = { version = "^0.7", features = ["codec"] } +reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "stream", "query", "form"] } + +[features] +default = ["native-tls"] +native-tls = ["reqwest/native-tls"] +rustls = ["reqwest/rustls"] diff --git a/crates/gitea-client/README.md b/crates/gitea-client/README.md index d237cfb..9ca6abe 100644 --- a/crates/gitea-client/README.md +++ b/crates/gitea-client/README.md @@ -7,9 +7,9 @@ This documentation describes the Gitea API. This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. -- API version: 1.22.1 -- Package version: 1.22.1 -- Generator version: 7.9.0-SNAPSHOT +- API version: 1.25.2 +- Package version: 1.25.2 +- Generator version: 7.21.0-SNAPSHOT - Build package: `org.openapitools.codegen.languages.RustClientCodegen` ## Installation @@ -34,6 +34,7 @@ Class | Method | HTTP request | Description *AdminApi* | [**admin_create_org**](docs/AdminApi.md#admin_create_org) | **POST** /admin/users/{username}/orgs | Create an organization *AdminApi* | [**admin_create_public_key**](docs/AdminApi.md#admin_create_public_key) | **POST** /admin/users/{username}/keys | Add a public key on behalf of a user *AdminApi* | [**admin_create_repo**](docs/AdminApi.md#admin_create_repo) | **POST** /admin/users/{username}/repos | Create a repository on behalf of a user +*AdminApi* | [**admin_create_runner_registration_token**](docs/AdminApi.md#admin_create_runner_registration_token) | **POST** /admin/actions/runners/registration-token | Get an global actions runner registration token *AdminApi* | [**admin_create_user**](docs/AdminApi.md#admin_create_user) | **POST** /admin/users | Create a user *AdminApi* | [**admin_cron_list**](docs/AdminApi.md#admin_cron_list) | **GET** /admin/cron | List cron tasks *AdminApi* | [**admin_cron_run**](docs/AdminApi.md#admin_cron_run) | **POST** /admin/cron/{task} | Run cron task @@ -54,6 +55,11 @@ Class | Method | HTTP request | Description *AdminApi* | [**admin_search_emails**](docs/AdminApi.md#admin_search_emails) | **GET** /admin/emails/search | Search all emails *AdminApi* | [**admin_search_users**](docs/AdminApi.md#admin_search_users) | **GET** /admin/users | Search users according filter conditions *AdminApi* | [**admin_unadopted_list**](docs/AdminApi.md#admin_unadopted_list) | **GET** /admin/unadopted | List unadopted repositories +*AdminApi* | [**delete_admin_runner**](docs/AdminApi.md#delete_admin_runner) | **DELETE** /admin/actions/runners/{runner_id} | Delete an global runner +*AdminApi* | [**get_admin_runner**](docs/AdminApi.md#get_admin_runner) | **GET** /admin/actions/runners/{runner_id} | Get an global runner +*AdminApi* | [**get_admin_runners**](docs/AdminApi.md#get_admin_runners) | **GET** /admin/actions/runners | Get all runners +*AdminApi* | [**list_admin_workflow_jobs**](docs/AdminApi.md#list_admin_workflow_jobs) | **GET** /admin/actions/jobs | Lists all jobs +*AdminApi* | [**list_admin_workflow_runs**](docs/AdminApi.md#list_admin_workflow_runs) | **GET** /admin/actions/runs | Lists all runs *IssueApi* | [**issue_add_label**](docs/IssueApi.md#issue_add_label) | **POST** /repos/{owner}/{repo}/issues/{index}/labels | Add a label to an issue *IssueApi* | [**issue_add_subscription**](docs/IssueApi.md#issue_add_subscription) | **PUT** /repos/{owner}/{repo}/issues/{index}/subscriptions/{user} | Subscribe user to issue *IssueApi* | [**issue_add_time**](docs/IssueApi.md#issue_add_time) | **POST** /repos/{owner}/{repo}/issues/{index}/times | Add tracked time to a issue @@ -106,6 +112,7 @@ Class | Method | HTTP request | Description *IssueApi* | [**issue_list_issue_dependencies**](docs/IssueApi.md#issue_list_issue_dependencies) | **GET** /repos/{owner}/{repo}/issues/{index}/dependencies | List an issue's dependencies, i.e all issues that block this issue. *IssueApi* | [**issue_list_issues**](docs/IssueApi.md#issue_list_issues) | **GET** /repos/{owner}/{repo}/issues | List a repository's issues *IssueApi* | [**issue_list_labels**](docs/IssueApi.md#issue_list_labels) | **GET** /repos/{owner}/{repo}/labels | Get all of a repository's labels +*IssueApi* | [**issue_lock_issue**](docs/IssueApi.md#issue_lock_issue) | **PUT** /repos/{owner}/{repo}/issues/{index}/lock | Lock an issue *IssueApi* | [**issue_post_comment_reaction**](docs/IssueApi.md#issue_post_comment_reaction) | **POST** /repos/{owner}/{repo}/issues/comments/{id}/reactions | Add a reaction to a comment of an issue *IssueApi* | [**issue_post_issue_reaction**](docs/IssueApi.md#issue_post_issue_reaction) | **POST** /repos/{owner}/{repo}/issues/{index}/reactions | Add a reaction to an issue *IssueApi* | [**issue_remove_issue_blocking**](docs/IssueApi.md#issue_remove_issue_blocking) | **DELETE** /repos/{owner}/{repo}/issues/{index}/blocks | Unblock the issue given in the body by the issue in path @@ -118,6 +125,7 @@ Class | Method | HTTP request | Description *IssueApi* | [**issue_stop_stop_watch**](docs/IssueApi.md#issue_stop_stop_watch) | **POST** /repos/{owner}/{repo}/issues/{index}/stopwatch/stop | Stop an issue's existing stopwatch. *IssueApi* | [**issue_subscriptions**](docs/IssueApi.md#issue_subscriptions) | **GET** /repos/{owner}/{repo}/issues/{index}/subscriptions | Get users who subscribed on an issue. *IssueApi* | [**issue_tracked_times**](docs/IssueApi.md#issue_tracked_times) | **GET** /repos/{owner}/{repo}/issues/{index}/times | List an issue's tracked times +*IssueApi* | [**issue_unlock_issue**](docs/IssueApi.md#issue_unlock_issue) | **DELETE** /repos/{owner}/{repo}/issues/{index}/lock | Unlock an issue *IssueApi* | [**move_issue_pin**](docs/IssueApi.md#move_issue_pin) | **PATCH** /repos/{owner}/{repo}/issues/{index}/pin/{position} | Moves the Pin to the given Position *IssueApi* | [**pin_issue**](docs/IssueApi.md#pin_issue) | **POST** /repos/{owner}/{repo}/issues/{index}/pin | Pin an Issue *IssueApi* | [**unpin_issue**](docs/IssueApi.md#unpin_issue) | **DELETE** /repos/{owner}/{repo}/issues/{index}/pin | Unpin an Issue @@ -126,6 +134,7 @@ Class | Method | HTTP request | Description *MiscellaneousApi* | [**get_license_template_info**](docs/MiscellaneousApi.md#get_license_template_info) | **GET** /licenses/{name} | Returns information about a license template *MiscellaneousApi* | [**get_node_info**](docs/MiscellaneousApi.md#get_node_info) | **GET** /nodeinfo | Returns the nodeinfo of the Gitea application *MiscellaneousApi* | [**get_signing_key**](docs/MiscellaneousApi.md#get_signing_key) | **GET** /signing-key.gpg | Get default signing-key.gpg +*MiscellaneousApi* | [**get_signing_key_ssh**](docs/MiscellaneousApi.md#get_signing_key_ssh) | **GET** /signing-key.pub | Get default signing-key.pub *MiscellaneousApi* | [**get_version**](docs/MiscellaneousApi.md#get_version) | **GET** /version | Returns the version of the Gitea application *MiscellaneousApi* | [**list_gitignores_templates**](docs/MiscellaneousApi.md#list_gitignores_templates) | **GET** /gitignore/templates | Returns a list of all gitignore templates *MiscellaneousApi* | [**list_label_templates**](docs/MiscellaneousApi.md#list_label_templates) | **GET** /label/templates | Returns a list of all label templates @@ -143,16 +152,22 @@ Class | Method | HTTP request | Description *OrganizationApi* | [**create_org_repo**](docs/OrganizationApi.md#create_org_repo) | **POST** /orgs/{org}/repos | Create a repository in an organization *OrganizationApi* | [**create_org_repo_deprecated**](docs/OrganizationApi.md#create_org_repo_deprecated) | **POST** /org/{org}/repos | Create a repository in an organization *OrganizationApi* | [**create_org_variable**](docs/OrganizationApi.md#create_org_variable) | **POST** /orgs/{org}/actions/variables/{variablename} | Create an org-level variable +*OrganizationApi* | [**delete_org_runner**](docs/OrganizationApi.md#delete_org_runner) | **DELETE** /orgs/{org}/actions/runners/{runner_id} | Delete an org-level runner *OrganizationApi* | [**delete_org_secret**](docs/OrganizationApi.md#delete_org_secret) | **DELETE** /orgs/{org}/actions/secrets/{secretname} | Delete a secret in an organization *OrganizationApi* | [**delete_org_variable**](docs/OrganizationApi.md#delete_org_variable) | **DELETE** /orgs/{org}/actions/variables/{variablename} | Delete an org-level variable +*OrganizationApi* | [**get_org_runner**](docs/OrganizationApi.md#get_org_runner) | **GET** /orgs/{org}/actions/runners/{runner_id} | Get an org-level runner +*OrganizationApi* | [**get_org_runners**](docs/OrganizationApi.md#get_org_runners) | **GET** /orgs/{org}/actions/runners | Get org-level runners *OrganizationApi* | [**get_org_variable**](docs/OrganizationApi.md#get_org_variable) | **GET** /orgs/{org}/actions/variables/{variablename} | Get an org-level variable *OrganizationApi* | [**get_org_variables_list**](docs/OrganizationApi.md#get_org_variables_list) | **GET** /orgs/{org}/actions/variables | Get an org-level variables list +*OrganizationApi* | [**get_org_workflow_jobs**](docs/OrganizationApi.md#get_org_workflow_jobs) | **GET** /orgs/{org}/actions/jobs | Get org-level workflow jobs +*OrganizationApi* | [**get_org_workflow_runs**](docs/OrganizationApi.md#get_org_workflow_runs) | **GET** /orgs/{org}/actions/runs | Get org-level workflow runs *OrganizationApi* | [**org_add_team_member**](docs/OrganizationApi.md#org_add_team_member) | **PUT** /teams/{id}/members/{username} | Add a team member *OrganizationApi* | [**org_add_team_repository**](docs/OrganizationApi.md#org_add_team_repository) | **PUT** /teams/{id}/repos/{org}/{repo} | Add a repository to a team *OrganizationApi* | [**org_conceal_member**](docs/OrganizationApi.md#org_conceal_member) | **DELETE** /orgs/{org}/public_members/{username} | Conceal a user's membership *OrganizationApi* | [**org_create**](docs/OrganizationApi.md#org_create) | **POST** /orgs | Create an organization *OrganizationApi* | [**org_create_hook**](docs/OrganizationApi.md#org_create_hook) | **POST** /orgs/{org}/hooks | Create a hook *OrganizationApi* | [**org_create_label**](docs/OrganizationApi.md#org_create_label) | **POST** /orgs/{org}/labels | Create a label for an organization +*OrganizationApi* | [**org_create_runner_registration_token**](docs/OrganizationApi.md#org_create_runner_registration_token) | **POST** /orgs/{org}/actions/runners/registration-token | Get an organization's actions runner registration token *OrganizationApi* | [**org_create_team**](docs/OrganizationApi.md#org_create_team) | **POST** /orgs/{org}/teams | Create a team *OrganizationApi* | [**org_delete**](docs/OrganizationApi.md#org_delete) | **DELETE** /orgs/{org} | Delete an organization *OrganizationApi* | [**org_delete_avatar**](docs/OrganizationApi.md#org_delete_avatar) | **DELETE** /orgs/{org}/avatar | Delete Avatar @@ -196,28 +211,54 @@ Class | Method | HTTP request | Description *OrganizationApi* | [**organization_check_user_block**](docs/OrganizationApi.md#organization_check_user_block) | **GET** /orgs/{org}/blocks/{username} | Check if a user is blocked by the organization *OrganizationApi* | [**organization_list_blocks**](docs/OrganizationApi.md#organization_list_blocks) | **GET** /orgs/{org}/blocks | List users blocked by the organization *OrganizationApi* | [**organization_unblock_user**](docs/OrganizationApi.md#organization_unblock_user) | **DELETE** /orgs/{org}/blocks/{username} | Unblock a user +*OrganizationApi* | [**rename_org**](docs/OrganizationApi.md#rename_org) | **POST** /orgs/{org}/rename | Rename an organization *OrganizationApi* | [**team_search**](docs/OrganizationApi.md#team_search) | **GET** /orgs/{org}/teams/search | Search for teams within an organization *OrganizationApi* | [**update_org_secret**](docs/OrganizationApi.md#update_org_secret) | **PUT** /orgs/{org}/actions/secrets/{secretname} | Create or Update a secret value in an organization *OrganizationApi* | [**update_org_variable**](docs/OrganizationApi.md#update_org_variable) | **PUT** /orgs/{org}/actions/variables/{variablename} | Update an org-level variable *PackageApi* | [**delete_package**](docs/PackageApi.md#delete_package) | **DELETE** /packages/{owner}/{type}/{name}/{version} | Delete a package +*PackageApi* | [**get_latest_package_version**](docs/PackageApi.md#get_latest_package_version) | **GET** /packages/{owner}/{type}/{name}/-/latest | Gets the latest version of a package *PackageApi* | [**get_package**](docs/PackageApi.md#get_package) | **GET** /packages/{owner}/{type}/{name}/{version} | Gets a package +*PackageApi* | [**link_package**](docs/PackageApi.md#link_package) | **POST** /packages/{owner}/{type}/{name}/-/link/{repo_name} | Link a package to a repository *PackageApi* | [**list_package_files**](docs/PackageApi.md#list_package_files) | **GET** /packages/{owner}/{type}/{name}/{version}/files | Gets all files of a package +*PackageApi* | [**list_package_versions**](docs/PackageApi.md#list_package_versions) | **GET** /packages/{owner}/{type}/{name} | Gets all versions of a package *PackageApi* | [**list_packages**](docs/PackageApi.md#list_packages) | **GET** /packages/{owner} | Gets all packages of an owner +*PackageApi* | [**unlink_package**](docs/PackageApi.md#unlink_package) | **POST** /packages/{owner}/{type}/{name}/-/unlink | Unlink a package from a repository *RepositoryApi* | [**accept_repo_transfer**](docs/RepositoryApi.md#accept_repo_transfer) | **POST** /repos/{owner}/{repo}/transfer/accept | Accept a repo transfer +*RepositoryApi* | [**actions_disable_workflow**](docs/RepositoryApi.md#actions_disable_workflow) | **PUT** /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable | Disable a workflow +*RepositoryApi* | [**actions_dispatch_workflow**](docs/RepositoryApi.md#actions_dispatch_workflow) | **POST** /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches | Create a workflow dispatch event +*RepositoryApi* | [**actions_enable_workflow**](docs/RepositoryApi.md#actions_enable_workflow) | **PUT** /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable | Enable a workflow +*RepositoryApi* | [**actions_get_workflow**](docs/RepositoryApi.md#actions_get_workflow) | **GET** /repos/{owner}/{repo}/actions/workflows/{workflow_id} | Get a workflow +*RepositoryApi* | [**actions_list_repository_workflows**](docs/RepositoryApi.md#actions_list_repository_workflows) | **GET** /repos/{owner}/{repo}/actions/workflows | List repository workflows *RepositoryApi* | [**create_current_user_repo**](docs/RepositoryApi.md#create_current_user_repo) | **POST** /user/repos | Create a repository *RepositoryApi* | [**create_fork**](docs/RepositoryApi.md#create_fork) | **POST** /repos/{owner}/{repo}/forks | Fork a repository *RepositoryApi* | [**create_repo_variable**](docs/RepositoryApi.md#create_repo_variable) | **POST** /repos/{owner}/{repo}/actions/variables/{variablename} | Create a repo-level variable +*RepositoryApi* | [**delete_action_run**](docs/RepositoryApi.md#delete_action_run) | **DELETE** /repos/{owner}/{repo}/actions/runs/{run} | Delete a workflow run +*RepositoryApi* | [**delete_artifact**](docs/RepositoryApi.md#delete_artifact) | **DELETE** /repos/{owner}/{repo}/actions/artifacts/{artifact_id} | Deletes a specific artifact for a workflow run +*RepositoryApi* | [**delete_repo_runner**](docs/RepositoryApi.md#delete_repo_runner) | **DELETE** /repos/{owner}/{repo}/actions/runners/{runner_id} | Delete an repo-level runner *RepositoryApi* | [**delete_repo_secret**](docs/RepositoryApi.md#delete_repo_secret) | **DELETE** /repos/{owner}/{repo}/actions/secrets/{secretname} | Delete a secret in a repository *RepositoryApi* | [**delete_repo_variable**](docs/RepositoryApi.md#delete_repo_variable) | **DELETE** /repos/{owner}/{repo}/actions/variables/{variablename} | Delete a repo-level variable +*RepositoryApi* | [**download_actions_run_job_logs**](docs/RepositoryApi.md#download_actions_run_job_logs) | **GET** /repos/{owner}/{repo}/actions/jobs/{job_id}/logs | Downloads the job logs for a workflow run +*RepositoryApi* | [**download_artifact**](docs/RepositoryApi.md#download_artifact) | **GET** /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/zip | Downloads a specific artifact for a workflow run redirects to blob url *RepositoryApi* | [**generate_repo**](docs/RepositoryApi.md#generate_repo) | **POST** /repos/{template_owner}/{template_repo}/generate | Create a repository using a template *RepositoryApi* | [**get_annotated_tag**](docs/RepositoryApi.md#get_annotated_tag) | **GET** /repos/{owner}/{repo}/git/tags/{sha} | Gets the tag object of an annotated tag (not lightweight tags) +*RepositoryApi* | [**get_artifact**](docs/RepositoryApi.md#get_artifact) | **GET** /repos/{owner}/{repo}/actions/artifacts/{artifact_id} | Gets a specific artifact for a workflow run +*RepositoryApi* | [**get_artifacts**](docs/RepositoryApi.md#get_artifacts) | **GET** /repos/{owner}/{repo}/actions/artifacts | Lists all artifacts for a repository +*RepositoryApi* | [**get_artifacts_of_run**](docs/RepositoryApi.md#get_artifacts_of_run) | **GET** /repos/{owner}/{repo}/actions/runs/{run}/artifacts | Lists all artifacts for a repository run *RepositoryApi* | [**get_blob**](docs/RepositoryApi.md#get_blob) | **GET** /repos/{owner}/{repo}/git/blobs/{sha} | Gets the blob of a repository. +*RepositoryApi* | [**get_repo_runner**](docs/RepositoryApi.md#get_repo_runner) | **GET** /repos/{owner}/{repo}/actions/runners/{runner_id} | Get an repo-level runner +*RepositoryApi* | [**get_repo_runners**](docs/RepositoryApi.md#get_repo_runners) | **GET** /repos/{owner}/{repo}/actions/runners | Get repo-level runners *RepositoryApi* | [**get_repo_variable**](docs/RepositoryApi.md#get_repo_variable) | **GET** /repos/{owner}/{repo}/actions/variables/{variablename} | Get a repo-level variable *RepositoryApi* | [**get_repo_variables_list**](docs/RepositoryApi.md#get_repo_variables_list) | **GET** /repos/{owner}/{repo}/actions/variables | Get repo-level variables list *RepositoryApi* | [**get_tree**](docs/RepositoryApi.md#get_tree) | **GET** /repos/{owner}/{repo}/git/trees/{sha} | Gets the tree of a repository. +*RepositoryApi* | [**get_workflow_job**](docs/RepositoryApi.md#get_workflow_job) | **GET** /repos/{owner}/{repo}/actions/jobs/{job_id} | Gets a specific workflow job for a workflow run +*RepositoryApi* | [**get_workflow_run**](docs/RepositoryApi.md#get_workflow_run) | **GET** /repos/{owner}/{repo}/actions/runs/{run} | Gets a specific workflow run +*RepositoryApi* | [**get_workflow_runs**](docs/RepositoryApi.md#get_workflow_runs) | **GET** /repos/{owner}/{repo}/actions/runs | Lists all runs for a repository run +*RepositoryApi* | [**list_action_tasks**](docs/RepositoryApi.md#list_action_tasks) | **GET** /repos/{owner}/{repo}/actions/tasks | List a repository's action tasks *RepositoryApi* | [**list_forks**](docs/RepositoryApi.md#list_forks) | **GET** /repos/{owner}/{repo}/forks | List a repository's forks +*RepositoryApi* | [**list_workflow_jobs**](docs/RepositoryApi.md#list_workflow_jobs) | **GET** /repos/{owner}/{repo}/actions/jobs | Lists all jobs for a repository +*RepositoryApi* | [**list_workflow_run_jobs**](docs/RepositoryApi.md#list_workflow_run_jobs) | **GET** /repos/{owner}/{repo}/actions/runs/{run}/jobs | Lists all jobs for a workflow run *RepositoryApi* | [**reject_repo_transfer**](docs/RepositoryApi.md#reject_repo_transfer) | **POST** /repos/{owner}/{repo}/transfer/reject | Reject a repo transfer -*RepositoryApi* | [**repo_add_collaborator**](docs/RepositoryApi.md#repo_add_collaborator) | **PUT** /repos/{owner}/{repo}/collaborators/{collaborator} | Add a collaborator to a repository +*RepositoryApi* | [**repo_add_collaborator**](docs/RepositoryApi.md#repo_add_collaborator) | **PUT** /repos/{owner}/{repo}/collaborators/{collaborator} | Add or Update a collaborator to a repository *RepositoryApi* | [**repo_add_push_mirror**](docs/RepositoryApi.md#repo_add_push_mirror) | **POST** /repos/{owner}/{repo}/push_mirrors | add a push mirror to the repository *RepositoryApi* | [**repo_add_team**](docs/RepositoryApi.md#repo_add_team) | **PUT** /repos/{owner}/{repo}/teams/{team} | Add a team to a repository *RepositoryApi* | [**repo_add_topic**](docs/RepositoryApi.md#repo_add_topic) | **PUT** /repos/{owner}/{repo}/topics/{topic} | Add a topic to a repository @@ -237,8 +278,10 @@ Class | Method | HTTP request | Description *RepositoryApi* | [**repo_create_pull_review_requests**](docs/RepositoryApi.md#repo_create_pull_review_requests) | **POST** /repos/{owner}/{repo}/pulls/{index}/requested_reviewers | create review requests for a pull request *RepositoryApi* | [**repo_create_release**](docs/RepositoryApi.md#repo_create_release) | **POST** /repos/{owner}/{repo}/releases | Create a release *RepositoryApi* | [**repo_create_release_attachment**](docs/RepositoryApi.md#repo_create_release_attachment) | **POST** /repos/{owner}/{repo}/releases/{id}/assets | Create a release attachment +*RepositoryApi* | [**repo_create_runner_registration_token**](docs/RepositoryApi.md#repo_create_runner_registration_token) | **POST** /repos/{owner}/{repo}/actions/runners/registration-token | Get a repository's actions runner registration token *RepositoryApi* | [**repo_create_status**](docs/RepositoryApi.md#repo_create_status) | **POST** /repos/{owner}/{repo}/statuses/{sha} | Create a commit status *RepositoryApi* | [**repo_create_tag**](docs/RepositoryApi.md#repo_create_tag) | **POST** /repos/{owner}/{repo}/tags | Create a new git tag in a repository +*RepositoryApi* | [**repo_create_tag_protection**](docs/RepositoryApi.md#repo_create_tag_protection) | **POST** /repos/{owner}/{repo}/tag_protections | Create a tag protections for a repository *RepositoryApi* | [**repo_create_wiki_page**](docs/RepositoryApi.md#repo_create_wiki_page) | **POST** /repos/{owner}/{repo}/wiki/new | Create a wiki page *RepositoryApi* | [**repo_delete**](docs/RepositoryApi.md#repo_delete) | **DELETE** /repos/{owner}/{repo} | Delete a repository *RepositoryApi* | [**repo_delete_avatar**](docs/RepositoryApi.md#repo_delete_avatar) | **DELETE** /repos/{owner}/{repo}/avatar | Delete avatar @@ -256,6 +299,7 @@ Class | Method | HTTP request | Description *RepositoryApi* | [**repo_delete_release_attachment**](docs/RepositoryApi.md#repo_delete_release_attachment) | **DELETE** /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id} | Delete a release attachment *RepositoryApi* | [**repo_delete_release_by_tag**](docs/RepositoryApi.md#repo_delete_release_by_tag) | **DELETE** /repos/{owner}/{repo}/releases/tags/{tag} | Delete a release by tag name *RepositoryApi* | [**repo_delete_tag**](docs/RepositoryApi.md#repo_delete_tag) | **DELETE** /repos/{owner}/{repo}/tags/{tag} | Delete a repository's tag by name +*RepositoryApi* | [**repo_delete_tag_protection**](docs/RepositoryApi.md#repo_delete_tag_protection) | **DELETE** /repos/{owner}/{repo}/tag_protections/{id} | Delete a specific tag protection for the repository *RepositoryApi* | [**repo_delete_team**](docs/RepositoryApi.md#repo_delete_team) | **DELETE** /repos/{owner}/{repo}/teams/{team} | Delete a team from a repository *RepositoryApi* | [**repo_delete_topic**](docs/RepositoryApi.md#repo_delete_topic) | **DELETE** /repos/{owner}/{repo}/topics/{topic} | Delete a topic from a repository *RepositoryApi* | [**repo_delete_wiki_page**](docs/RepositoryApi.md#repo_delete_wiki_page) | **DELETE** /repos/{owner}/{repo}/wiki/page/{pageName} | Delete a wiki page @@ -269,6 +313,7 @@ Class | Method | HTTP request | Description *RepositoryApi* | [**repo_edit_pull_request**](docs/RepositoryApi.md#repo_edit_pull_request) | **PATCH** /repos/{owner}/{repo}/pulls/{index} | Update a pull request. If using deadline only the date will be taken into account, and time of day ignored. *RepositoryApi* | [**repo_edit_release**](docs/RepositoryApi.md#repo_edit_release) | **PATCH** /repos/{owner}/{repo}/releases/{id} | Update a release *RepositoryApi* | [**repo_edit_release_attachment**](docs/RepositoryApi.md#repo_edit_release_attachment) | **PATCH** /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id} | Edit a release attachment +*RepositoryApi* | [**repo_edit_tag_protection**](docs/RepositoryApi.md#repo_edit_tag_protection) | **PATCH** /repos/{owner}/{repo}/tag_protections/{id} | Edit a tag protections for a repository. Only fields that are set will be changed *RepositoryApi* | [**repo_edit_wiki_page**](docs/RepositoryApi.md#repo_edit_wiki_page) | **PATCH** /repos/{owner}/{repo}/wiki/page/{pageName} | Edit a wiki page *RepositoryApi* | [**repo_get**](docs/RepositoryApi.md#repo_get) | **GET** /repos/{owner}/{repo} | Get a repository *RepositoryApi* | [**repo_get_all_commits**](docs/RepositoryApi.md#repo_get_all_commits) | **GET** /repos/{owner}/{repo}/commits | Get a list of all commits from a repository @@ -278,10 +323,13 @@ Class | Method | HTTP request | Description *RepositoryApi* | [**repo_get_branch_protection**](docs/RepositoryApi.md#repo_get_branch_protection) | **GET** /repos/{owner}/{repo}/branch_protections/{name} | Get a specific branch protection for the repository *RepositoryApi* | [**repo_get_by_id**](docs/RepositoryApi.md#repo_get_by_id) | **GET** /repositories/{id} | Get a repository by id *RepositoryApi* | [**repo_get_combined_status_by_ref**](docs/RepositoryApi.md#repo_get_combined_status_by_ref) | **GET** /repos/{owner}/{repo}/commits/{ref}/status | Get a commit's combined status, by branch/tag/commit reference -*RepositoryApi* | [**repo_get_commit_pull_request**](docs/RepositoryApi.md#repo_get_commit_pull_request) | **GET** /repos/{owner}/{repo}/commits/{sha}/pull | Get the pull request of the commit -*RepositoryApi* | [**repo_get_contents**](docs/RepositoryApi.md#repo_get_contents) | **GET** /repos/{owner}/{repo}/contents/{filepath} | Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir -*RepositoryApi* | [**repo_get_contents_list**](docs/RepositoryApi.md#repo_get_contents_list) | **GET** /repos/{owner}/{repo}/contents | Gets the metadata of all the entries of the root dir +*RepositoryApi* | [**repo_get_commit_pull_request**](docs/RepositoryApi.md#repo_get_commit_pull_request) | **GET** /repos/{owner}/{repo}/commits/{sha}/pull | Get the merged pull request of the commit +*RepositoryApi* | [**repo_get_contents**](docs/RepositoryApi.md#repo_get_contents) | **GET** /repos/{owner}/{repo}/contents/{filepath} | Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir. +*RepositoryApi* | [**repo_get_contents_ext**](docs/RepositoryApi.md#repo_get_contents_ext) | **GET** /repos/{owner}/{repo}/contents-ext/{filepath} | The extended \"contents\" API, to get file metadata and/or content, or list a directory. +*RepositoryApi* | [**repo_get_contents_list**](docs/RepositoryApi.md#repo_get_contents_list) | **GET** /repos/{owner}/{repo}/contents | Gets the metadata of all the entries of the root dir. *RepositoryApi* | [**repo_get_editor_config**](docs/RepositoryApi.md#repo_get_editor_config) | **GET** /repos/{owner}/{repo}/editorconfig/{filepath} | Get the EditorConfig definitions of a file in a repository +*RepositoryApi* | [**repo_get_file_contents**](docs/RepositoryApi.md#repo_get_file_contents) | **GET** /repos/{owner}/{repo}/file-contents | Get the metadata and contents of requested files +*RepositoryApi* | [**repo_get_file_contents_post**](docs/RepositoryApi.md#repo_get_file_contents_post) | **POST** /repos/{owner}/{repo}/file-contents | Get the metadata and contents of requested files *RepositoryApi* | [**repo_get_git_hook**](docs/RepositoryApi.md#repo_get_git_hook) | **GET** /repos/{owner}/{repo}/hooks/git/{id} | Get a Git hook *RepositoryApi* | [**repo_get_hook**](docs/RepositoryApi.md#repo_get_hook) | **GET** /repos/{owner}/{repo}/hooks/{id} | Get a hook *RepositoryApi* | [**repo_get_issue_config**](docs/RepositoryApi.md#repo_get_issue_config) | **GET** /repos/{owner}/{repo}/issue_config | Returns the issue config for a repo @@ -289,6 +337,7 @@ Class | Method | HTTP request | Description *RepositoryApi* | [**repo_get_key**](docs/RepositoryApi.md#repo_get_key) | **GET** /repos/{owner}/{repo}/keys/{id} | Get a repository's key by id *RepositoryApi* | [**repo_get_languages**](docs/RepositoryApi.md#repo_get_languages) | **GET** /repos/{owner}/{repo}/languages | Get languages and number of bytes of code written *RepositoryApi* | [**repo_get_latest_release**](docs/RepositoryApi.md#repo_get_latest_release) | **GET** /repos/{owner}/{repo}/releases/latest | Gets the most recent non-prerelease, non-draft release of a repository, sorted by created_at +*RepositoryApi* | [**repo_get_licenses**](docs/RepositoryApi.md#repo_get_licenses) | **GET** /repos/{owner}/{repo}/licenses | Get repo licenses *RepositoryApi* | [**repo_get_note**](docs/RepositoryApi.md#repo_get_note) | **GET** /repos/{owner}/{repo}/git/notes/{sha} | Get a note corresponding to a single commit from a repository *RepositoryApi* | [**repo_get_pull_request**](docs/RepositoryApi.md#repo_get_pull_request) | **GET** /repos/{owner}/{repo}/pulls/{index} | Get a pull request *RepositoryApi* | [**repo_get_pull_request_by_base_head**](docs/RepositoryApi.md#repo_get_pull_request_by_base_head) | **GET** /repos/{owner}/{repo}/pulls/{base}/{head} | Get a pull request by base and head @@ -304,9 +353,10 @@ Class | Method | HTTP request | Description *RepositoryApi* | [**repo_get_release_by_tag**](docs/RepositoryApi.md#repo_get_release_by_tag) | **GET** /repos/{owner}/{repo}/releases/tags/{tag} | Get a release by tag name *RepositoryApi* | [**repo_get_repo_permissions**](docs/RepositoryApi.md#repo_get_repo_permissions) | **GET** /repos/{owner}/{repo}/collaborators/{collaborator}/permission | Get repository permissions for a user *RepositoryApi* | [**repo_get_reviewers**](docs/RepositoryApi.md#repo_get_reviewers) | **GET** /repos/{owner}/{repo}/reviewers | Return all users that can be requested to review in this repo -*RepositoryApi* | [**repo_get_runner_registration_token**](docs/RepositoryApi.md#repo_get_runner_registration_token) | **GET** /repos/{owner}/{repo}/runners/registration-token | Get a repository's actions runner registration token +*RepositoryApi* | [**repo_get_runner_registration_token**](docs/RepositoryApi.md#repo_get_runner_registration_token) | **GET** /repos/{owner}/{repo}/actions/runners/registration-token | Get a repository's actions runner registration token *RepositoryApi* | [**repo_get_single_commit**](docs/RepositoryApi.md#repo_get_single_commit) | **GET** /repos/{owner}/{repo}/git/commits/{sha} | Get a single commit from a repository *RepositoryApi* | [**repo_get_tag**](docs/RepositoryApi.md#repo_get_tag) | **GET** /repos/{owner}/{repo}/tags/{tag} | Get the tag of a repository by tag name +*RepositoryApi* | [**repo_get_tag_protection**](docs/RepositoryApi.md#repo_get_tag_protection) | **GET** /repos/{owner}/{repo}/tag_protections/{id} | Get a specific tag protection for the repository *RepositoryApi* | [**repo_get_wiki_page**](docs/RepositoryApi.md#repo_get_wiki_page) | **GET** /repos/{owner}/{repo}/wiki/page/{pageName} | Get a wiki page *RepositoryApi* | [**repo_get_wiki_page_revisions**](docs/RepositoryApi.md#repo_get_wiki_page_revisions) | **GET** /repos/{owner}/{repo}/wiki/revisions/{pageName} | Get revisions of a wiki page *RepositoryApi* | [**repo_get_wiki_pages**](docs/RepositoryApi.md#repo_get_wiki_pages) | **GET** /repos/{owner}/{repo}/wiki/pages | Get all wiki pages @@ -331,23 +381,28 @@ Class | Method | HTTP request | Description *RepositoryApi* | [**repo_list_statuses**](docs/RepositoryApi.md#repo_list_statuses) | **GET** /repos/{owner}/{repo}/statuses/{sha} | Get a commit's statuses *RepositoryApi* | [**repo_list_statuses_by_ref**](docs/RepositoryApi.md#repo_list_statuses_by_ref) | **GET** /repos/{owner}/{repo}/commits/{ref}/statuses | Get a commit's statuses, by branch/tag/commit reference *RepositoryApi* | [**repo_list_subscribers**](docs/RepositoryApi.md#repo_list_subscribers) | **GET** /repos/{owner}/{repo}/subscribers | List a repo's watchers +*RepositoryApi* | [**repo_list_tag_protection**](docs/RepositoryApi.md#repo_list_tag_protection) | **GET** /repos/{owner}/{repo}/tag_protections | List tag protections for a repository *RepositoryApi* | [**repo_list_tags**](docs/RepositoryApi.md#repo_list_tags) | **GET** /repos/{owner}/{repo}/tags | List a repository's tags *RepositoryApi* | [**repo_list_teams**](docs/RepositoryApi.md#repo_list_teams) | **GET** /repos/{owner}/{repo}/teams | List a repository's teams *RepositoryApi* | [**repo_list_topics**](docs/RepositoryApi.md#repo_list_topics) | **GET** /repos/{owner}/{repo}/topics | Get list of topics that a repository has *RepositoryApi* | [**repo_merge_pull_request**](docs/RepositoryApi.md#repo_merge_pull_request) | **POST** /repos/{owner}/{repo}/pulls/{index}/merge | Merge a pull request +*RepositoryApi* | [**repo_merge_upstream**](docs/RepositoryApi.md#repo_merge_upstream) | **POST** /repos/{owner}/{repo}/merge-upstream | Merge a branch from upstream *RepositoryApi* | [**repo_migrate**](docs/RepositoryApi.md#repo_migrate) | **POST** /repos/migrate | Migrate a remote git repository *RepositoryApi* | [**repo_mirror_sync**](docs/RepositoryApi.md#repo_mirror_sync) | **POST** /repos/{owner}/{repo}/mirror-sync | Sync a mirrored repository *RepositoryApi* | [**repo_new_pin_allowed**](docs/RepositoryApi.md#repo_new_pin_allowed) | **GET** /repos/{owner}/{repo}/new_pin_allowed | Returns if new Issue Pins are allowed *RepositoryApi* | [**repo_pull_request_is_merged**](docs/RepositoryApi.md#repo_pull_request_is_merged) | **GET** /repos/{owner}/{repo}/pulls/{index}/merge | Check if a pull request has been merged *RepositoryApi* | [**repo_push_mirror_sync**](docs/RepositoryApi.md#repo_push_mirror_sync) | **POST** /repos/{owner}/{repo}/push_mirrors-sync | Sync all push mirrored repository +*RepositoryApi* | [**repo_rename_branch**](docs/RepositoryApi.md#repo_rename_branch) | **PATCH** /repos/{owner}/{repo}/branches/{branch} | Rename a branch *RepositoryApi* | [**repo_search**](docs/RepositoryApi.md#repo_search) | **GET** /repos/search | Search for repositories *RepositoryApi* | [**repo_signing_key**](docs/RepositoryApi.md#repo_signing_key) | **GET** /repos/{owner}/{repo}/signing-key.gpg | Get signing-key.gpg for given repository +*RepositoryApi* | [**repo_signing_key_ssh**](docs/RepositoryApi.md#repo_signing_key_ssh) | **GET** /repos/{owner}/{repo}/signing-key.pub | Get signing-key.pub for given repository *RepositoryApi* | [**repo_submit_pull_review**](docs/RepositoryApi.md#repo_submit_pull_review) | **POST** /repos/{owner}/{repo}/pulls/{index}/reviews/{id} | Submit a pending review to an pull request *RepositoryApi* | [**repo_test_hook**](docs/RepositoryApi.md#repo_test_hook) | **POST** /repos/{owner}/{repo}/hooks/{id}/tests | Test a push webhook *RepositoryApi* | [**repo_tracked_times**](docs/RepositoryApi.md#repo_tracked_times) | **GET** /repos/{owner}/{repo}/times | List a repo's tracked times *RepositoryApi* | [**repo_transfer**](docs/RepositoryApi.md#repo_transfer) | **POST** /repos/{owner}/{repo}/transfer | Transfer a repo ownership *RepositoryApi* | [**repo_un_dismiss_pull_review**](docs/RepositoryApi.md#repo_un_dismiss_pull_review) | **POST** /repos/{owner}/{repo}/pulls/{index}/reviews/{id}/undismissals | Cancel to dismiss a review for a pull request *RepositoryApi* | [**repo_update_avatar**](docs/RepositoryApi.md#repo_update_avatar) | **POST** /repos/{owner}/{repo}/avatar | Update avatar +*RepositoryApi* | [**repo_update_branch_protection_priories**](docs/RepositoryApi.md#repo_update_branch_protection_priories) | **POST** /repos/{owner}/{repo}/branch_protections/priority | Update the priorities of branch protections for a repository. *RepositoryApi* | [**repo_update_file**](docs/RepositoryApi.md#repo_update_file) | **PUT** /repos/{owner}/{repo}/contents/{filepath} | Update a file in a repository *RepositoryApi* | [**repo_update_pull_request**](docs/RepositoryApi.md#repo_update_pull_request) | **POST** /repos/{owner}/{repo}/pulls/{index}/update | Merge PR's baseBranch into headBranch *RepositoryApi* | [**repo_update_topics**](docs/RepositoryApi.md#repo_update_topics) | **PUT** /repos/{owner}/{repo}/topics | Replace list of topics for a repository @@ -365,11 +420,16 @@ Class | Method | HTTP request | Description *SettingsApi* | [**get_general_ui_settings**](docs/SettingsApi.md#get_general_ui_settings) | **GET** /settings/ui | Get instance's global settings for ui *UserApi* | [**create_current_user_repo**](docs/UserApi.md#create_current_user_repo) | **POST** /user/repos | Create a repository *UserApi* | [**create_user_variable**](docs/UserApi.md#create_user_variable) | **POST** /user/actions/variables/{variablename} | Create a user-level variable +*UserApi* | [**delete_user_runner**](docs/UserApi.md#delete_user_runner) | **DELETE** /user/actions/runners/{runner_id} | Delete an user-level runner *UserApi* | [**delete_user_secret**](docs/UserApi.md#delete_user_secret) | **DELETE** /user/actions/secrets/{secretname} | Delete a secret in a user scope *UserApi* | [**delete_user_variable**](docs/UserApi.md#delete_user_variable) | **DELETE** /user/actions/variables/{variablename} | Delete a user-level variable which is created by current doer +*UserApi* | [**get_user_runner**](docs/UserApi.md#get_user_runner) | **GET** /user/actions/runners/{runner_id} | Get an user-level runner +*UserApi* | [**get_user_runners**](docs/UserApi.md#get_user_runners) | **GET** /user/actions/runners | Get user-level runners *UserApi* | [**get_user_settings**](docs/UserApi.md#get_user_settings) | **GET** /user/settings | Get user settings *UserApi* | [**get_user_variable**](docs/UserApi.md#get_user_variable) | **GET** /user/actions/variables/{variablename} | Get a user-level variable which is created by current doer *UserApi* | [**get_user_variables_list**](docs/UserApi.md#get_user_variables_list) | **GET** /user/actions/variables | Get the user-level list of variables which is created by current doer +*UserApi* | [**get_user_workflow_jobs**](docs/UserApi.md#get_user_workflow_jobs) | **GET** /user/actions/jobs | Get workflow jobs +*UserApi* | [**get_user_workflow_runs**](docs/UserApi.md#get_user_workflow_runs) | **GET** /user/actions/runs | Get workflow runs *UserApi* | [**get_verification_token**](docs/UserApi.md#get_verification_token) | **GET** /user/gpg_key_token | Get a Token to verify *UserApi* | [**update_user_secret**](docs/UserApi.md#update_user_secret) | **PUT** /user/actions/secrets/{secretname} | Create or Update a secret value in a user scope *UserApi* | [**update_user_settings**](docs/UserApi.md#update_user_settings) | **PATCH** /user/settings | Update user settings @@ -380,6 +440,7 @@ Class | Method | HTTP request | Description *UserApi* | [**user_check_user_block**](docs/UserApi.md#user_check_user_block) | **GET** /user/blocks/{username} | Check if a user is blocked by the authenticated user *UserApi* | [**user_create_hook**](docs/UserApi.md#user_create_hook) | **POST** /user/hooks | Create a hook *UserApi* | [**user_create_o_auth2_application**](docs/UserApi.md#user_create_o_auth2_application) | **POST** /user/applications/oauth2 | creates a new OAuth2 application +*UserApi* | [**user_create_runner_registration_token**](docs/UserApi.md#user_create_runner_registration_token) | **POST** /user/actions/runners/registration-token | Get an user's actions runner registration token *UserApi* | [**user_create_token**](docs/UserApi.md#user_create_token) | **POST** /users/{username}/tokens | Create an access token *UserApi* | [**user_current_check_following**](docs/UserApi.md#user_current_check_following) | **GET** /user/following/{username} | Check whether a user is followed by the authenticated user *UserApi* | [**user_current_check_starring**](docs/UserApi.md#user_current_check_starring) | **GET** /user/starred/{owner}/{repo} | Whether the authenticated is starring the repo @@ -438,7 +499,21 @@ Class | Method | HTTP request | Description ## Documentation For Models - [AccessToken](docs/AccessToken.md) + - [ActionArtifact](docs/ActionArtifact.md) + - [ActionArtifactsResponse](docs/ActionArtifactsResponse.md) + - [ActionRunner](docs/ActionRunner.md) + - [ActionRunnerLabel](docs/ActionRunnerLabel.md) + - [ActionRunnersResponse](docs/ActionRunnersResponse.md) + - [ActionTask](docs/ActionTask.md) + - [ActionTaskResponse](docs/ActionTaskResponse.md) - [ActionVariable](docs/ActionVariable.md) + - [ActionWorkflow](docs/ActionWorkflow.md) + - [ActionWorkflowJob](docs/ActionWorkflowJob.md) + - [ActionWorkflowJobsResponse](docs/ActionWorkflowJobsResponse.md) + - [ActionWorkflowResponse](docs/ActionWorkflowResponse.md) + - [ActionWorkflowRun](docs/ActionWorkflowRun.md) + - [ActionWorkflowRunsResponse](docs/ActionWorkflowRunsResponse.md) + - [ActionWorkflowStep](docs/ActionWorkflowStep.md) - [Activity](docs/Activity.md) - [ActivityPub](docs/ActivityPub.md) - [AddCollaboratorOption](docs/AddCollaboratorOption.md) @@ -446,6 +521,7 @@ Class | Method | HTTP request | Description - [AnnotatedTag](docs/AnnotatedTag.md) - [AnnotatedTagObject](docs/AnnotatedTagObject.md) - [ApiError](docs/ApiError.md) + - [ApplyDiffPatchFileOptions](docs/ApplyDiffPatchFileOptions.md) - [Attachment](docs/Attachment.md) - [Badge](docs/Badge.md) - [Branch](docs/Branch.md) @@ -463,8 +539,10 @@ Class | Method | HTTP request | Description - [CommitStatus](docs/CommitStatus.md) - [CommitUser](docs/CommitUser.md) - [Compare](docs/Compare.md) + - [ContentsExtResponse](docs/ContentsExtResponse.md) - [ContentsResponse](docs/ContentsResponse.md) - [CreateAccessTokenOption](docs/CreateAccessTokenOption.md) + - [CreateActionWorkflowDispatch](docs/CreateActionWorkflowDispatch.md) - [CreateBranchProtectionOption](docs/CreateBranchProtectionOption.md) - [CreateBranchRepoOption](docs/CreateBranchRepoOption.md) - [CreateEmailOption](docs/CreateEmailOption.md) @@ -488,6 +566,7 @@ Class | Method | HTTP request | Description - [CreateRepoOption](docs/CreateRepoOption.md) - [CreateStatusOption](docs/CreateStatusOption.md) - [CreateTagOption](docs/CreateTagOption.md) + - [CreateTagProtectionOption](docs/CreateTagProtectionOption.md) - [CreateTeamOption](docs/CreateTeamOption.md) - [CreateUserOption](docs/CreateUserOption.md) - [CreateVariableOption](docs/CreateVariableOption.md) @@ -511,6 +590,7 @@ Class | Method | HTTP request | Description - [EditReactionOption](docs/EditReactionOption.md) - [EditReleaseOption](docs/EditReleaseOption.md) - [EditRepoOption](docs/EditRepoOption.md) + - [EditTagProtectionOption](docs/EditTagProtectionOption.md) - [EditTeamOption](docs/EditTeamOption.md) - [EditUserOption](docs/EditUserOption.md) - [Email](docs/Email.md) @@ -526,6 +606,7 @@ Class | Method | HTTP request | Description - [GeneralRepoSettings](docs/GeneralRepoSettings.md) - [GeneralUiSettings](docs/GeneralUiSettings.md) - [GenerateRepoOption](docs/GenerateRepoOption.md) + - [GetFilesOptions](docs/GetFilesOptions.md) - [GitBlobResponse](docs/GitBlobResponse.md) - [GitEntry](docs/GitEntry.md) - [GitHook](docs/GitHook.md) @@ -550,9 +631,12 @@ Class | Method | HTTP request | Description - [LabelTemplate](docs/LabelTemplate.md) - [LicenseTemplateInfo](docs/LicenseTemplateInfo.md) - [LicensesTemplateListEntry](docs/LicensesTemplateListEntry.md) + - [LockIssueOption](docs/LockIssueOption.md) - [MarkdownOption](docs/MarkdownOption.md) - [MarkupOption](docs/MarkupOption.md) - [MergePullRequestOption](docs/MergePullRequestOption.md) + - [MergeUpstreamRequest](docs/MergeUpstreamRequest.md) + - [MergeUpstreamResponse](docs/MergeUpstreamResponse.md) - [MigrateRepoOptions](docs/MigrateRepoOptions.md) - [Milestone](docs/Milestone.md) - [NewIssuePinsAllowed](docs/NewIssuePinsAllowed.md) @@ -585,6 +669,8 @@ Class | Method | HTTP request | Description - [Reaction](docs/Reaction.md) - [Reference](docs/Reference.md) - [Release](docs/Release.md) + - [RenameBranchRepoOption](docs/RenameBranchRepoOption.md) + - [RenameOrgOption](docs/RenameOrgOption.md) - [RenameUserOption](docs/RenameUserOption.md) - [RepoCollaboratorPermission](docs/RepoCollaboratorPermission.md) - [RepoCommit](docs/RepoCommit.md) @@ -599,6 +685,7 @@ Class | Method | HTTP request | Description - [StopWatch](docs/StopWatch.md) - [SubmitPullReviewOptions](docs/SubmitPullReviewOptions.md) - [Tag](docs/Tag.md) + - [TagProtection](docs/TagProtection.md) - [Team](docs/Team.md) - [TeamSearch200Response](docs/TeamSearch200Response.md) - [TimelineComment](docs/TimelineComment.md) @@ -606,6 +693,7 @@ Class | Method | HTTP request | Description - [TopicResponse](docs/TopicResponse.md) - [TrackedTime](docs/TrackedTime.md) - [TransferRepoOption](docs/TransferRepoOption.md) + - [UpdateBranchProtectionPriories](docs/UpdateBranchProtectionPriories.md) - [UpdateFileOptions](docs/UpdateFileOptions.md) - [UpdateRepoAvatarOption](docs/UpdateRepoAvatarOption.md) - [UpdateUserAvatarOption](docs/UpdateUserAvatarOption.md) diff --git a/crates/gitea-client/docs/AccessToken.md b/crates/gitea-client/docs/AccessToken.md index d52fb41..010811d 100644 --- a/crates/gitea-client/docs/AccessToken.md +++ b/crates/gitea-client/docs/AccessToken.md @@ -4,11 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | Option<**i64**> | | [optional] -**name** | Option<**String**> | | [optional] -**scopes** | Option<**Vec**> | | [optional] -**sha1** | Option<**String**> | | [optional] -**token_last_eight** | Option<**String**> | | [optional] +**created_at** | Option<**String**> | The timestamp when the token was created | [optional] +**id** | Option<**i64**> | The unique identifier of the access token | [optional] +**last_used_at** | Option<**String**> | The timestamp when the token was last used | [optional] +**name** | Option<**String**> | The name of the access token | [optional] +**scopes** | Option<**Vec**> | The scopes granted to this access token | [optional] +**sha1** | Option<**String**> | The SHA1 hash of the access token | [optional] +**token_last_eight** | Option<**String**> | The last eight characters of the token | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/ActionArtifact.md b/crates/gitea-client/docs/ActionArtifact.md new file mode 100644 index 0000000..b7f6d0a --- /dev/null +++ b/crates/gitea-client/docs/ActionArtifact.md @@ -0,0 +1,20 @@ +# ActionArtifact + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**archive_download_url** | Option<**String**> | | [optional] +**created_at** | Option<**String**> | | [optional] +**expired** | Option<**bool**> | | [optional] +**expires_at** | Option<**String**> | | [optional] +**id** | Option<**i64**> | | [optional] +**name** | Option<**String**> | | [optional] +**size_in_bytes** | Option<**i64**> | | [optional] +**updated_at** | Option<**String**> | | [optional] +**url** | Option<**String**> | | [optional] +**workflow_run** | Option<[**models::ActionWorkflowRun**](ActionWorkflowRun.md)> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ActionArtifactsResponse.md b/crates/gitea-client/docs/ActionArtifactsResponse.md new file mode 100644 index 0000000..10c115a --- /dev/null +++ b/crates/gitea-client/docs/ActionArtifactsResponse.md @@ -0,0 +1,12 @@ +# ActionArtifactsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**artifacts** | Option<[**Vec**](ActionArtifact.md)> | | [optional] +**total_count** | Option<**i64**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ActionRunner.md b/crates/gitea-client/docs/ActionRunner.md new file mode 100644 index 0000000..df318e7 --- /dev/null +++ b/crates/gitea-client/docs/ActionRunner.md @@ -0,0 +1,16 @@ +# ActionRunner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**busy** | Option<**bool**> | | [optional] +**ephemeral** | Option<**bool**> | | [optional] +**id** | Option<**i64**> | | [optional] +**labels** | Option<[**Vec**](ActionRunnerLabel.md)> | | [optional] +**name** | Option<**String**> | | [optional] +**status** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ActionRunnerLabel.md b/crates/gitea-client/docs/ActionRunnerLabel.md new file mode 100644 index 0000000..8f3872c --- /dev/null +++ b/crates/gitea-client/docs/ActionRunnerLabel.md @@ -0,0 +1,13 @@ +# ActionRunnerLabel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | Option<**i64**> | | [optional] +**name** | Option<**String**> | | [optional] +**r#type** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ActionRunnersResponse.md b/crates/gitea-client/docs/ActionRunnersResponse.md new file mode 100644 index 0000000..385e68c --- /dev/null +++ b/crates/gitea-client/docs/ActionRunnersResponse.md @@ -0,0 +1,12 @@ +# ActionRunnersResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**runners** | Option<[**Vec**](ActionRunner.md)> | | [optional] +**total_count** | Option<**i64**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ActionTask.md b/crates/gitea-client/docs/ActionTask.md new file mode 100644 index 0000000..d361ff7 --- /dev/null +++ b/crates/gitea-client/docs/ActionTask.md @@ -0,0 +1,23 @@ +# ActionTask + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**created_at** | Option<**String**> | | [optional] +**display_title** | Option<**String**> | DisplayTitle is the display title for the workflow run | [optional] +**event** | Option<**String**> | Event is the type of event that triggered the workflow | [optional] +**head_branch** | Option<**String**> | HeadBranch is the branch that triggered the workflow | [optional] +**head_sha** | Option<**String**> | HeadSHA is the commit SHA that triggered the workflow | [optional] +**id** | Option<**i64**> | ID is the unique identifier for the action task | [optional] +**name** | Option<**String**> | Name is the name of the workflow | [optional] +**run_number** | Option<**i64**> | RunNumber is the sequential number of the workflow run | [optional] +**run_started_at** | Option<**String**> | | [optional] +**status** | Option<**String**> | Status indicates the current status of the workflow run | [optional] +**updated_at** | Option<**String**> | | [optional] +**url** | Option<**String**> | URL is the API URL for this workflow run | [optional] +**workflow_id** | Option<**String**> | WorkflowID is the identifier of the workflow | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ActionTaskResponse.md b/crates/gitea-client/docs/ActionTaskResponse.md new file mode 100644 index 0000000..022ebb2 --- /dev/null +++ b/crates/gitea-client/docs/ActionTaskResponse.md @@ -0,0 +1,12 @@ +# ActionTaskResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_count** | Option<**i64**> | TotalCount is the total number of workflow runs | [optional] +**workflow_runs** | Option<[**Vec**](ActionTask.md)> | Entries contains the list of workflow runs | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ActionVariable.md b/crates/gitea-client/docs/ActionVariable.md index 663b9c0..ad22b5d 100644 --- a/crates/gitea-client/docs/ActionVariable.md +++ b/crates/gitea-client/docs/ActionVariable.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **data** | Option<**String**> | the value of the variable | [optional] +**description** | Option<**String**> | the description of the variable | [optional] **name** | Option<**String**> | the name of the variable | [optional] **owner_id** | Option<**i64**> | the owner to which the variable belongs | [optional] **repo_id** | Option<**i64**> | the repository to which the variable belongs | [optional] diff --git a/crates/gitea-client/docs/ActionWorkflow.md b/crates/gitea-client/docs/ActionWorkflow.md new file mode 100644 index 0000000..283dd56 --- /dev/null +++ b/crates/gitea-client/docs/ActionWorkflow.md @@ -0,0 +1,20 @@ +# ActionWorkflow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**badge_url** | Option<**String**> | BadgeURL is the URL for the workflow badge | [optional] +**created_at** | Option<**String**> | | [optional] +**deleted_at** | Option<**String**> | | [optional] +**html_url** | Option<**String**> | HTMLURL is the web URL for viewing the workflow | [optional] +**id** | Option<**String**> | ID is the unique identifier for the workflow | [optional] +**name** | Option<**String**> | Name is the name of the workflow | [optional] +**path** | Option<**String**> | Path is the file path of the workflow | [optional] +**state** | Option<**String**> | State indicates if the workflow is active or disabled | [optional] +**updated_at** | Option<**String**> | | [optional] +**url** | Option<**String**> | URL is the API URL for this workflow | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ActionWorkflowJob.md b/crates/gitea-client/docs/ActionWorkflowJob.md new file mode 100644 index 0000000..0e355e3 --- /dev/null +++ b/crates/gitea-client/docs/ActionWorkflowJob.md @@ -0,0 +1,28 @@ +# ActionWorkflowJob + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**completed_at** | Option<**String**> | | [optional] +**conclusion** | Option<**String**> | | [optional] +**created_at** | Option<**String**> | | [optional] +**head_branch** | Option<**String**> | | [optional] +**head_sha** | Option<**String**> | | [optional] +**html_url** | Option<**String**> | | [optional] +**id** | Option<**i64**> | | [optional] +**labels** | Option<**Vec**> | | [optional] +**name** | Option<**String**> | | [optional] +**run_attempt** | Option<**i64**> | | [optional] +**run_id** | Option<**i64**> | | [optional] +**run_url** | Option<**String**> | | [optional] +**runner_id** | Option<**i64**> | | [optional] +**runner_name** | Option<**String**> | | [optional] +**started_at** | Option<**String**> | | [optional] +**status** | Option<**String**> | | [optional] +**steps** | Option<[**Vec**](ActionWorkflowStep.md)> | | [optional] +**url** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ActionWorkflowJobsResponse.md b/crates/gitea-client/docs/ActionWorkflowJobsResponse.md new file mode 100644 index 0000000..20d17db --- /dev/null +++ b/crates/gitea-client/docs/ActionWorkflowJobsResponse.md @@ -0,0 +1,12 @@ +# ActionWorkflowJobsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**jobs** | Option<[**Vec**](ActionWorkflowJob.md)> | | [optional] +**total_count** | Option<**i64**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ActionWorkflowResponse.md b/crates/gitea-client/docs/ActionWorkflowResponse.md new file mode 100644 index 0000000..2b1af82 --- /dev/null +++ b/crates/gitea-client/docs/ActionWorkflowResponse.md @@ -0,0 +1,12 @@ +# ActionWorkflowResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_count** | Option<**i64**> | | [optional] +**workflows** | Option<[**Vec**](ActionWorkflow.md)> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ActionWorkflowRun.md b/crates/gitea-client/docs/ActionWorkflowRun.md new file mode 100644 index 0000000..757597f --- /dev/null +++ b/crates/gitea-client/docs/ActionWorkflowRun.md @@ -0,0 +1,29 @@ +# ActionWorkflowRun + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**actor** | Option<[**models::User**](User.md)> | | [optional] +**completed_at** | Option<**String**> | | [optional] +**conclusion** | Option<**String**> | | [optional] +**display_title** | Option<**String**> | | [optional] +**event** | Option<**String**> | | [optional] +**head_branch** | Option<**String**> | | [optional] +**head_repository** | Option<[**models::Repository**](Repository.md)> | | [optional] +**head_sha** | Option<**String**> | | [optional] +**html_url** | Option<**String**> | | [optional] +**id** | Option<**i64**> | | [optional] +**path** | Option<**String**> | | [optional] +**repository** | Option<[**models::Repository**](Repository.md)> | | [optional] +**repository_id** | Option<**i64**> | | [optional] +**run_attempt** | Option<**i64**> | | [optional] +**run_number** | Option<**i64**> | | [optional] +**started_at** | Option<**String**> | | [optional] +**status** | Option<**String**> | | [optional] +**trigger_actor** | Option<[**models::User**](User.md)> | | [optional] +**url** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ActionWorkflowRunsResponse.md b/crates/gitea-client/docs/ActionWorkflowRunsResponse.md new file mode 100644 index 0000000..788abd1 --- /dev/null +++ b/crates/gitea-client/docs/ActionWorkflowRunsResponse.md @@ -0,0 +1,12 @@ +# ActionWorkflowRunsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_count** | Option<**i64**> | | [optional] +**workflow_runs** | Option<[**Vec**](ActionWorkflowRun.md)> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ActionWorkflowStep.md b/crates/gitea-client/docs/ActionWorkflowStep.md new file mode 100644 index 0000000..569094c --- /dev/null +++ b/crates/gitea-client/docs/ActionWorkflowStep.md @@ -0,0 +1,16 @@ +# ActionWorkflowStep + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**completed_at** | Option<**String**> | | [optional] +**conclusion** | Option<**String**> | | [optional] +**name** | Option<**String**> | | [optional] +**number** | Option<**i64**> | | [optional] +**started_at** | Option<**String**> | | [optional] +**status** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/Activity.md b/crates/gitea-client/docs/Activity.md index c2bb1b7..90575f6 100644 --- a/crates/gitea-client/docs/Activity.md +++ b/crates/gitea-client/docs/Activity.md @@ -5,18 +5,18 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **act_user** | Option<[**models::User**](User.md)> | | [optional] -**act_user_id** | Option<**i64**> | | [optional] +**act_user_id** | Option<**i64**> | The ID of the user who performed the action | [optional] **comment** | Option<[**models::Comment**](Comment.md)> | | [optional] -**comment_id** | Option<**i64**> | | [optional] -**content** | Option<**String**> | | [optional] -**created** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**is_private** | Option<**bool**> | | [optional] -**op_type** | Option<**String**> | | [optional] -**ref_name** | Option<**String**> | | [optional] +**comment_id** | Option<**i64**> | The ID of the comment associated with the activity (if applicable) | [optional] +**content** | Option<**String**> | Additional content or details about the activity | [optional] +**created** | Option<**String**> | The date and time when the activity occurred | [optional] +**id** | Option<**i64**> | The unique identifier of the activity | [optional] +**is_private** | Option<**bool**> | Whether this activity is from a private repository | [optional] +**op_type** | Option<**OpType**> | the type of action (enum: create_repo, rename_repo, star_repo, watch_repo, commit_repo, create_issue, create_pull_request, transfer_repo, push_tag, comment_issue, merge_pull_request, close_issue, reopen_issue, close_pull_request, reopen_pull_request, delete_tag, delete_branch, mirror_sync_push, mirror_sync_create, mirror_sync_delete, approve_pull_request, reject_pull_request, comment_pull, publish_release, pull_review_dismissed, pull_request_ready_for_review, auto_merge_pull_request) | [optional] +**ref_name** | Option<**String**> | The name of the git reference (branch/tag) associated with the activity | [optional] **repo** | Option<[**models::Repository**](Repository.md)> | | [optional] -**repo_id** | Option<**i64**> | | [optional] -**user_id** | Option<**i64**> | | [optional] +**repo_id** | Option<**i64**> | The ID of the repository associated with the activity | [optional] +**user_id** | Option<**i64**> | The ID of the user who receives/sees this activity | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/ActivityPub.md b/crates/gitea-client/docs/ActivityPub.md index 433610d..e624386 100644 --- a/crates/gitea-client/docs/ActivityPub.md +++ b/crates/gitea-client/docs/ActivityPub.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**at_context** | Option<**String**> | | [optional] +**at_context** | Option<**String**> | Context defines the JSON-LD context for ActivityPub | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/AddCollaboratorOption.md b/crates/gitea-client/docs/AddCollaboratorOption.md index 353eaa4..c614fd6 100644 --- a/crates/gitea-client/docs/AddCollaboratorOption.md +++ b/crates/gitea-client/docs/AddCollaboratorOption.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**permission** | Option<**String**> | | [optional] +**permission** | Option<**Permission**> | (enum: read, write, admin) | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/AddTimeOption.md b/crates/gitea-client/docs/AddTimeOption.md index e64bdc4..b07e282 100644 --- a/crates/gitea-client/docs/AddTimeOption.md +++ b/crates/gitea-client/docs/AddTimeOption.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created** | Option<**String**> | | [optional] **time** | **i64** | time in seconds | -**user_name** | Option<**String**> | User who spent the time (optional) | [optional] +**user_name** | Option<**String**> | username of the user who spent the time working on the issue (optional) | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/AdminApi.md b/crates/gitea-client/docs/AdminApi.md index 865ad0e..256be0c 100644 --- a/crates/gitea-client/docs/AdminApi.md +++ b/crates/gitea-client/docs/AdminApi.md @@ -10,6 +10,7 @@ Method | HTTP request | Description [**admin_create_org**](AdminApi.md#admin_create_org) | **POST** /admin/users/{username}/orgs | Create an organization [**admin_create_public_key**](AdminApi.md#admin_create_public_key) | **POST** /admin/users/{username}/keys | Add a public key on behalf of a user [**admin_create_repo**](AdminApi.md#admin_create_repo) | **POST** /admin/users/{username}/repos | Create a repository on behalf of a user +[**admin_create_runner_registration_token**](AdminApi.md#admin_create_runner_registration_token) | **POST** /admin/actions/runners/registration-token | Get an global actions runner registration token [**admin_create_user**](AdminApi.md#admin_create_user) | **POST** /admin/users | Create a user [**admin_cron_list**](AdminApi.md#admin_cron_list) | **GET** /admin/cron | List cron tasks [**admin_cron_run**](AdminApi.md#admin_cron_run) | **POST** /admin/cron/{task} | Run cron task @@ -30,6 +31,11 @@ Method | HTTP request | Description [**admin_search_emails**](AdminApi.md#admin_search_emails) | **GET** /admin/emails/search | Search all emails [**admin_search_users**](AdminApi.md#admin_search_users) | **GET** /admin/users | Search users according filter conditions [**admin_unadopted_list**](AdminApi.md#admin_unadopted_list) | **GET** /admin/unadopted | List unadopted repositories +[**delete_admin_runner**](AdminApi.md#delete_admin_runner) | **DELETE** /admin/actions/runners/{runner_id} | Delete an global runner +[**get_admin_runner**](AdminApi.md#get_admin_runner) | **GET** /admin/actions/runners/{runner_id} | Get an global runner +[**get_admin_runners**](AdminApi.md#get_admin_runners) | **GET** /admin/actions/runners | Get all runners +[**list_admin_workflow_jobs**](AdminApi.md#list_admin_workflow_jobs) | **GET** /admin/actions/jobs | Lists all jobs +[**list_admin_workflow_runs**](AdminApi.md#list_admin_workflow_runs) | **GET** /admin/actions/runs | Lists all runs @@ -43,7 +49,7 @@ Add a badge to a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user to whom a badge is to be added | [required] | **body** | Option<[**UserBadgeOption**](UserBadgeOption.md)> | | | ### Return type @@ -129,7 +135,7 @@ Create an organization Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of the user that will own the created organization | [required] | +**username** | **String** | username of the user who will own the created organization | [required] | **organization** | [**CreateOrgOption**](CreateOrgOption.md) | | [required] | ### Return type @@ -158,7 +164,7 @@ Add a public key on behalf of a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of the user | [required] | +**username** | **String** | username of the user who is to receive a public key | [required] | **key** | Option<[**CreateKeyOption**](CreateKeyOption.md)> | | | ### Return type @@ -187,7 +193,7 @@ Create a repository on behalf of a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of the user. This user will own the created repository | [required] | +**username** | **String** | username of the user who will own the created repository | [required] | **repository** | [**CreateRepoOption**](CreateRepoOption.md) | | [required] | ### Return type @@ -206,6 +212,31 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## admin_create_runner_registration_token + +> admin_create_runner_registration_token() +Get an global actions runner registration token + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## admin_create_user > models::User admin_create_user(body) @@ -358,7 +389,7 @@ Delete a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user to delete | [required] | +**username** | **String** | username of the user to delete | [required] | **purge** | Option<**bool**> | purge the user from the system completely | | ### Return type @@ -387,7 +418,7 @@ Remove a badge from a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose badge is to be deleted | [required] | **body** | Option<[**UserBadgeOption**](UserBadgeOption.md)> | | | ### Return type @@ -416,7 +447,7 @@ Delete a user's public key Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose public key is to be deleted | [required] | **id** | **i64** | id of the key to delete | [required] | ### Return type @@ -474,7 +505,7 @@ Edit an existing user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user to edit | [required] | +**username** | **String** | username of the user whose data is to be edited | [required] | **body** | Option<[**EditUserOption**](EditUserOption.md)> | | | ### Return type @@ -606,7 +637,7 @@ This endpoint does not need any parameter. ## admin_list_hooks -> Vec admin_list_hooks(page, limit) +> Vec admin_list_hooks(page, limit, r#type) List system's webhooks ### Parameters @@ -616,6 +647,7 @@ Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | +**r#type** | Option<**String**> | system, default or both kinds of webhooks | |[default to system] ### Return type @@ -643,7 +675,7 @@ List a user's badges Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose badges are to be listed | [required] | ### Return type @@ -671,7 +703,7 @@ Rename a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | existing username of user | [required] | +**username** | **String** | current username of the user | [required] | **body** | [**RenameUserOption**](RenameUserOption.md) | | [required] | ### Return type @@ -731,7 +763,7 @@ Search users according filter conditions Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **source_id** | Option<**i64**> | ID of the user's login source to search for | | -**login_name** | Option<**String**> | user's login name to search for | | +**login_name** | Option<**String**> | identifier of the user, provided by the external authenticator | | **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | @@ -780,3 +812,148 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +## delete_admin_runner + +> delete_admin_runner(runner_id) +Delete an global runner + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**runner_id** | **String** | id of the runner | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## get_admin_runner + +> get_admin_runner(runner_id) +Get an global runner + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**runner_id** | **String** | id of the runner | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## get_admin_runners + +> get_admin_runners() +Get all runners + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## list_admin_workflow_jobs + +> models::ActionWorkflowJobsResponse list_admin_workflow_jobs(status, page, limit) +Lists all jobs + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**status** | Option<**String**> | workflow status (pending, queued, in_progress, failure, success, skipped) | | +**page** | Option<**i32**> | page number of results to return (1-based) | | +**limit** | Option<**i32**> | page size of results | | + +### Return type + +[**models::ActionWorkflowJobsResponse**](ActionWorkflowJobsResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## list_admin_workflow_runs + +> models::ActionWorkflowRunsResponse list_admin_workflow_runs(event, branch, status, actor, head_sha, page, limit) +Lists all runs + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**event** | Option<**String**> | workflow event name | | +**branch** | Option<**String**> | workflow branch | | +**status** | Option<**String**> | workflow status (pending, queued, in_progress, failure, success, skipped) | | +**actor** | Option<**String**> | triggered by user | | +**head_sha** | Option<**String**> | triggering sha of the workflow run | | +**page** | Option<**i32**> | page number of results to return (1-based) | | +**limit** | Option<**i32**> | page size of results | | + +### Return type + +[**models::ActionWorkflowRunsResponse**](ActionWorkflowRunsResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/crates/gitea-client/docs/AnnotatedTag.md b/crates/gitea-client/docs/AnnotatedTag.md index 62f9713..b7198c6 100644 --- a/crates/gitea-client/docs/AnnotatedTag.md +++ b/crates/gitea-client/docs/AnnotatedTag.md @@ -4,12 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**message** | Option<**String**> | | [optional] +**message** | Option<**String**> | The message associated with the annotated tag | [optional] **object** | Option<[**models::AnnotatedTagObject**](AnnotatedTagObject.md)> | | [optional] -**sha** | Option<**String**> | | [optional] -**tag** | Option<**String**> | | [optional] +**sha** | Option<**String**> | The SHA hash of the annotated tag | [optional] +**tag** | Option<**String**> | The name of the annotated tag | [optional] **tagger** | Option<[**models::CommitUser**](CommitUser.md)> | | [optional] -**url** | Option<**String**> | | [optional] +**url** | Option<**String**> | The URL to access the annotated tag | [optional] **verification** | Option<[**models::PayloadCommitVerification**](PayloadCommitVerification.md)> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/AnnotatedTagObject.md b/crates/gitea-client/docs/AnnotatedTagObject.md index 01837b9..7fc738b 100644 --- a/crates/gitea-client/docs/AnnotatedTagObject.md +++ b/crates/gitea-client/docs/AnnotatedTagObject.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**sha** | Option<**String**> | | [optional] -**r#type** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**sha** | Option<**String**> | The SHA hash of the tagged object | [optional] +**r#type** | Option<**String**> | The type of the tagged object (e.g., commit, tree) | [optional] +**url** | Option<**String**> | The URL to access the tagged object | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/ApiError.md b/crates/gitea-client/docs/ApiError.md index 94e66d5..48e267f 100644 --- a/crates/gitea-client/docs/ApiError.md +++ b/crates/gitea-client/docs/ApiError.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**message** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**message** | Option<**String**> | Message contains the error description | [optional] +**url** | Option<**String**> | URL contains the documentation URL for this error | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/ApplyDiffPatchFileOptions.md b/crates/gitea-client/docs/ApplyDiffPatchFileOptions.md new file mode 100644 index 0000000..7ddde23 --- /dev/null +++ b/crates/gitea-client/docs/ApplyDiffPatchFileOptions.md @@ -0,0 +1,18 @@ +# ApplyDiffPatchFileOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**author** | Option<[**models::Identity**](Identity.md)> | | [optional] +**branch** | Option<**String**> | branch (optional) to base this file from. if not given, the default branch is used | [optional] +**committer** | Option<[**models::Identity**](Identity.md)> | | [optional] +**content** | **String** | | +**dates** | Option<[**models::CommitDateOptions**](CommitDateOptions.md)> | | [optional] +**message** | Option<**String**> | message (optional) for the commit of this file. if not supplied, a default message will be used | [optional] +**new_branch** | Option<**String**> | new_branch (optional) will make a new branch from `branch` before creating the file | [optional] +**signoff** | Option<**bool**> | Add a Signed-off-by trailer by the committer at the end of the commit log message. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/Attachment.md b/crates/gitea-client/docs/Attachment.md index 98debb9..69df7e3 100644 --- a/crates/gitea-client/docs/Attachment.md +++ b/crates/gitea-client/docs/Attachment.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**browser_download_url** | Option<**String**> | | [optional] +**browser_download_url** | Option<**String**> | DownloadURL is the URL to download the attachment | [optional] **created_at** | Option<**String**> | | [optional] -**download_count** | Option<**i64**> | | [optional] -**id** | Option<**i64**> | | [optional] -**name** | Option<**String**> | | [optional] -**size** | Option<**i64**> | | [optional] -**uuid** | Option<**String**> | | [optional] +**download_count** | Option<**i64**> | DownloadCount is the number of times the attachment has been downloaded | [optional] +**id** | Option<**i64**> | ID is the unique identifier for the attachment | [optional] +**name** | Option<**String**> | Name is the filename of the attachment | [optional] +**size** | Option<**i64**> | Size is the file size in bytes | [optional] +**uuid** | Option<**String**> | UUID is the unique identifier for the attachment file | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Branch.md b/crates/gitea-client/docs/Branch.md index 4f50aa0..2d386e1 100644 --- a/crates/gitea-client/docs/Branch.md +++ b/crates/gitea-client/docs/Branch.md @@ -5,14 +5,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **commit** | Option<[**models::PayloadCommit**](PayloadCommit.md)> | | [optional] -**effective_branch_protection_name** | Option<**String**> | | [optional] -**enable_status_check** | Option<**bool**> | | [optional] -**name** | Option<**String**> | | [optional] -**protected** | Option<**bool**> | | [optional] -**required_approvals** | Option<**i64**> | | [optional] -**status_check_contexts** | Option<**Vec**> | | [optional] -**user_can_merge** | Option<**bool**> | | [optional] -**user_can_push** | Option<**bool**> | | [optional] +**effective_branch_protection_name** | Option<**String**> | EffectiveBranchProtectionName is the name of the effective branch protection rule | [optional] +**enable_status_check** | Option<**bool**> | EnableStatusCheck indicates if status checks are enabled | [optional] +**name** | Option<**String**> | Name is the branch name | [optional] +**protected** | Option<**bool**> | Protected indicates if the branch is protected | [optional] +**required_approvals** | Option<**i64**> | RequiredApprovals is the number of required approvals for pull requests | [optional] +**status_check_contexts** | Option<**Vec**> | StatusCheckContexts contains the list of required status check contexts | [optional] +**user_can_merge** | Option<**bool**> | UserCanMerge indicates if the current user can merge to this branch | [optional] +**user_can_push** | Option<**bool**> | UserCanPush indicates if the current user can push to this branch | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/BranchProtection.md b/crates/gitea-client/docs/BranchProtection.md index 2ec372f..6a0460f 100644 --- a/crates/gitea-client/docs/BranchProtection.md +++ b/crates/gitea-client/docs/BranchProtection.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **approvals_whitelist_teams** | Option<**Vec**> | | [optional] **approvals_whitelist_username** | Option<**Vec**> | | [optional] +**block_admin_merge_override** | Option<**bool**> | | [optional] **block_on_official_review_requests** | Option<**bool**> | | [optional] **block_on_outdated_branch** | Option<**bool**> | | [optional] **block_on_rejected_reviews** | Option<**bool**> | | [optional] @@ -13,20 +14,26 @@ Name | Type | Description | Notes **created_at** | Option<**String**> | | [optional] **dismiss_stale_approvals** | Option<**bool**> | | [optional] **enable_approvals_whitelist** | Option<**bool**> | | [optional] +**enable_force_push** | Option<**bool**> | | [optional] +**enable_force_push_allowlist** | Option<**bool**> | | [optional] **enable_merge_whitelist** | Option<**bool**> | | [optional] **enable_push** | Option<**bool**> | | [optional] **enable_push_whitelist** | Option<**bool**> | | [optional] **enable_status_check** | Option<**bool**> | | [optional] +**force_push_allowlist_deploy_keys** | Option<**bool**> | | [optional] +**force_push_allowlist_teams** | Option<**Vec**> | | [optional] +**force_push_allowlist_usernames** | Option<**Vec**> | | [optional] **ignore_stale_approvals** | Option<**bool**> | | [optional] **merge_whitelist_teams** | Option<**Vec**> | | [optional] **merge_whitelist_usernames** | Option<**Vec**> | | [optional] +**priority** | Option<**i64**> | Priority is the priority of this branch protection rule | [optional] **protected_file_patterns** | Option<**String**> | | [optional] **push_whitelist_deploy_keys** | Option<**bool**> | | [optional] **push_whitelist_teams** | Option<**Vec**> | | [optional] **push_whitelist_usernames** | Option<**Vec**> | | [optional] **require_signed_commits** | Option<**bool**> | | [optional] **required_approvals** | Option<**i64**> | | [optional] -**rule_name** | Option<**String**> | | [optional] +**rule_name** | Option<**String**> | RuleName is the name of the branch protection rule | [optional] **status_check_contexts** | Option<**Vec**> | | [optional] **unprotected_file_patterns** | Option<**String**> | | [optional] **updated_at** | Option<**String**> | | [optional] diff --git a/crates/gitea-client/docs/ChangeFileOperation.md b/crates/gitea-client/docs/ChangeFileOperation.md index c142e61..e10157f 100644 --- a/crates/gitea-client/docs/ChangeFileOperation.md +++ b/crates/gitea-client/docs/ChangeFileOperation.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**content** | Option<**String**> | new or updated file content, must be base64 encoded | [optional] +**content** | Option<**String**> | new or updated file content, it must be base64 encoded | [optional] **from_path** | Option<**String**> | old path of the file to move | [optional] -**operation** | **String** | indicates what to do with the file | +**operation** | **Operation** | indicates what to do with the file: \"create\" for creating a new file, \"update\" for updating an existing file, \"upload\" for creating or updating a file, \"rename\" for renaming a file, and \"delete\" for deleting an existing file. (enum: create, update, upload, rename, delete) | **path** | **String** | path to the existing or new file | -**sha** | Option<**String**> | sha is the SHA for the file that already exists, required for update or delete | [optional] +**sha** | Option<**String**> | the blob ID (SHA) for the file that already exists, required for changing existing files | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/ChangedFile.md b/crates/gitea-client/docs/ChangedFile.md index 680133b..e8e0085 100644 --- a/crates/gitea-client/docs/ChangedFile.md +++ b/crates/gitea-client/docs/ChangedFile.md @@ -4,15 +4,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**additions** | Option<**i64**> | | [optional] -**changes** | Option<**i64**> | | [optional] -**contents_url** | Option<**String**> | | [optional] -**deletions** | Option<**i64**> | | [optional] -**filename** | Option<**String**> | | [optional] -**html_url** | Option<**String**> | | [optional] -**previous_filename** | Option<**String**> | | [optional] -**raw_url** | Option<**String**> | | [optional] -**status** | Option<**String**> | | [optional] +**additions** | Option<**i64**> | The number of lines added to the file | [optional] +**changes** | Option<**i64**> | The total number of changes to the file | [optional] +**contents_url** | Option<**String**> | The API URL to get the file contents | [optional] +**deletions** | Option<**i64**> | The number of lines deleted from the file | [optional] +**filename** | Option<**String**> | The name of the changed file | [optional] +**html_url** | Option<**String**> | The HTML URL to view the file changes | [optional] +**previous_filename** | Option<**String**> | The previous filename if the file was renamed | [optional] +**raw_url** | Option<**String**> | The raw URL to download the file | [optional] +**status** | Option<**String**> | The status of the file change (added, modified, deleted, etc.) | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CombinedStatus.md b/crates/gitea-client/docs/CombinedStatus.md index e18c57f..402702c 100644 --- a/crates/gitea-client/docs/CombinedStatus.md +++ b/crates/gitea-client/docs/CombinedStatus.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**commit_url** | Option<**String**> | | [optional] +**commit_url** | Option<**String**> | CommitURL is the API URL for the commit | [optional] **repository** | Option<[**models::Repository**](Repository.md)> | | [optional] -**sha** | Option<**String**> | | [optional] -**state** | Option<**String**> | CommitStatusState holds the state of a CommitStatus It can be \"pending\", \"success\", \"error\" and \"failure\" | [optional] -**statuses** | Option<[**Vec**](CommitStatus.md)> | | [optional] -**total_count** | Option<**i64**> | | [optional] -**url** | Option<**String**> | | [optional] +**sha** | Option<**String**> | SHA is the commit SHA this status applies to | [optional] +**state** | Option<**State**> | State is the overall combined status state pending CommitStatusPending CommitStatusPending is for when the CommitStatus is Pending success CommitStatusSuccess CommitStatusSuccess is for when the CommitStatus is Success error CommitStatusError CommitStatusError is for when the CommitStatus is Error failure CommitStatusFailure CommitStatusFailure is for when the CommitStatus is Failure warning CommitStatusWarning CommitStatusWarning is for when the CommitStatus is Warning skipped CommitStatusSkipped CommitStatusSkipped is for when CommitStatus is Skipped (enum: pending, success, error, failure, warning, skipped) | [optional] +**statuses** | Option<[**Vec**](CommitStatus.md)> | Statuses contains all individual commit statuses | [optional] +**total_count** | Option<**i64**> | TotalCount is the total number of statuses | [optional] +**url** | Option<**String**> | URL is the API URL for this combined status | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Comment.md b/crates/gitea-client/docs/Comment.md index fcf0484..26c6b40 100644 --- a/crates/gitea-client/docs/Comment.md +++ b/crates/gitea-client/docs/Comment.md @@ -4,15 +4,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**assets** | Option<[**Vec**](Attachment.md)> | | [optional] -**body** | Option<**String**> | | [optional] +**assets** | Option<[**Vec**](Attachment.md)> | Attachments contains files attached to the comment | [optional] +**body** | Option<**String**> | Body contains the comment text content | [optional] **created_at** | Option<**String**> | | [optional] -**html_url** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**issue_url** | Option<**String**> | | [optional] -**original_author** | Option<**String**> | | [optional] -**original_author_id** | Option<**i64**> | | [optional] -**pull_request_url** | Option<**String**> | | [optional] +**html_url** | Option<**String**> | HTMLURL is the web URL for viewing the comment | [optional] +**id** | Option<**i64**> | ID is the unique identifier for the comment | [optional] +**issue_url** | Option<**String**> | IssueURL is the API URL for the issue | [optional] +**original_author** | Option<**String**> | OriginalAuthor is the original author name (for imported comments) | [optional] +**original_author_id** | Option<**i64**> | OriginalAuthorID is the original author ID (for imported comments) | [optional] +**pull_request_url** | Option<**String**> | PRURL is the API URL for the pull request (if applicable) | [optional] **updated_at** | Option<**String**> | | [optional] **user** | Option<[**models::User**](User.md)> | | [optional] diff --git a/crates/gitea-client/docs/Commit.md b/crates/gitea-client/docs/Commit.md index 6bc6fd8..668f1f6 100644 --- a/crates/gitea-client/docs/Commit.md +++ b/crates/gitea-client/docs/Commit.md @@ -8,12 +8,12 @@ Name | Type | Description | Notes **commit** | Option<[**models::RepoCommit**](RepoCommit.md)> | | [optional] **committer** | Option<[**models::User**](User.md)> | | [optional] **created** | Option<**String**> | | [optional] -**files** | Option<[**Vec**](CommitAffectedFiles.md)> | | [optional] -**html_url** | Option<**String**> | | [optional] -**parents** | Option<[**Vec**](CommitMeta.md)> | | [optional] -**sha** | Option<**String**> | | [optional] +**files** | Option<[**Vec**](CommitAffectedFiles.md)> | Files contains information about files affected by the commit | [optional] +**html_url** | Option<**String**> | HTMLURL is the web URL for viewing the commit | [optional] +**parents** | Option<[**Vec**](CommitMeta.md)> | Parents contains the parent commit information | [optional] +**sha** | Option<**String**> | SHA is the commit SHA hash | [optional] **stats** | Option<[**models::CommitStats**](CommitStats.md)> | | [optional] -**url** | Option<**String**> | | [optional] +**url** | Option<**String**> | URL is the API URL for the commit | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CommitAffectedFiles.md b/crates/gitea-client/docs/CommitAffectedFiles.md index 04ca21e..cbb9b29 100644 --- a/crates/gitea-client/docs/CommitAffectedFiles.md +++ b/crates/gitea-client/docs/CommitAffectedFiles.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**filename** | Option<**String**> | | [optional] -**status** | Option<**String**> | | [optional] +**filename** | Option<**String**> | Filename is the path of the affected file | [optional] +**status** | Option<**String**> | Status indicates how the file was affected (added, modified, deleted) | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CommitMeta.md b/crates/gitea-client/docs/CommitMeta.md index e026016..5b2363c 100644 --- a/crates/gitea-client/docs/CommitMeta.md +++ b/crates/gitea-client/docs/CommitMeta.md @@ -5,8 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created** | Option<**String**> | | [optional] -**sha** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**sha** | Option<**String**> | SHA is the commit SHA hash | [optional] +**url** | Option<**String**> | URL is the API URL for the commit | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CommitStats.md b/crates/gitea-client/docs/CommitStats.md index 1ebf9e2..3b69627 100644 --- a/crates/gitea-client/docs/CommitStats.md +++ b/crates/gitea-client/docs/CommitStats.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**additions** | Option<**i64**> | | [optional] -**deletions** | Option<**i64**> | | [optional] -**total** | Option<**i64**> | | [optional] +**additions** | Option<**i64**> | Additions is the number of lines added | [optional] +**deletions** | Option<**i64**> | Deletions is the number of lines deleted | [optional] +**total** | Option<**i64**> | Total is the total number of lines changed | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CommitStatus.md b/crates/gitea-client/docs/CommitStatus.md index 241eb78..e37b441 100644 --- a/crates/gitea-client/docs/CommitStatus.md +++ b/crates/gitea-client/docs/CommitStatus.md @@ -4,15 +4,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**context** | Option<**String**> | | [optional] +**context** | Option<**String**> | Context is the unique context identifier for the status | [optional] **created_at** | Option<**String**> | | [optional] **creator** | Option<[**models::User**](User.md)> | | [optional] -**description** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**status** | Option<**String**> | CommitStatusState holds the state of a CommitStatus It can be \"pending\", \"success\", \"error\" and \"failure\" | [optional] -**target_url** | Option<**String**> | | [optional] +**description** | Option<**String**> | Description provides a brief description of the status | [optional] +**id** | Option<**i64**> | ID is the unique identifier for the commit status | [optional] +**status** | Option<**Status**> | State represents the status state (pending, success, error, failure) pending CommitStatusPending CommitStatusPending is for when the CommitStatus is Pending success CommitStatusSuccess CommitStatusSuccess is for when the CommitStatus is Success error CommitStatusError CommitStatusError is for when the CommitStatus is Error failure CommitStatusFailure CommitStatusFailure is for when the CommitStatus is Failure warning CommitStatusWarning CommitStatusWarning is for when the CommitStatus is Warning skipped CommitStatusSkipped CommitStatusSkipped is for when CommitStatus is Skipped (enum: pending, success, error, failure, warning, skipped) | [optional] +**target_url** | Option<**String**> | TargetURL is the URL to link to for more details | [optional] **updated_at** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**url** | Option<**String**> | URL is the API URL for this status | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CommitUser.md b/crates/gitea-client/docs/CommitUser.md index cafe69d..1745c7b 100644 --- a/crates/gitea-client/docs/CommitUser.md +++ b/crates/gitea-client/docs/CommitUser.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**date** | Option<**String**> | | [optional] +**date** | Option<**String**> | Date is the commit date in string format | [optional] **email** | Option<**String**> | | [optional] -**name** | Option<**String**> | | [optional] +**name** | Option<**String**> | Name is the person's name | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/ContentsExtResponse.md b/crates/gitea-client/docs/ContentsExtResponse.md new file mode 100644 index 0000000..2297bc0 --- /dev/null +++ b/crates/gitea-client/docs/ContentsExtResponse.md @@ -0,0 +1,12 @@ +# ContentsExtResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dir_contents** | Option<[**Vec**](ContentsResponse.md)> | DirContents contains directory listing when the path represents a directory | [optional] +**file_contents** | Option<[**models::ContentsResponse**](ContentsResponse.md)> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/ContentsResponse.md b/crates/gitea-client/docs/ContentsResponse.md index d6ed6c5..757f7c7 100644 --- a/crates/gitea-client/docs/ContentsResponse.md +++ b/crates/gitea-client/docs/ContentsResponse.md @@ -6,19 +6,24 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **_links** | Option<[**models::FileLinksResponse**](FileLinksResponse.md)> | | [optional] **content** | Option<**String**> | `content` is populated when `type` is `file`, otherwise null | [optional] -**download_url** | Option<**String**> | | [optional] +**download_url** | Option<**String**> | DownloadURL is the direct download URL for this file | [optional] **encoding** | Option<**String**> | `encoding` is populated when `type` is `file`, otherwise null | [optional] -**git_url** | Option<**String**> | | [optional] -**html_url** | Option<**String**> | | [optional] -**last_commit_sha** | Option<**String**> | | [optional] -**name** | Option<**String**> | | [optional] -**path** | Option<**String**> | | [optional] -**sha** | Option<**String**> | | [optional] -**size** | Option<**i64**> | | [optional] +**git_url** | Option<**String**> | GitURL is the Git API URL for this blob or tree | [optional] +**html_url** | Option<**String**> | HTMLURL is the web URL for this file or directory | [optional] +**last_author_date** | Option<**String**> | | [optional] +**last_commit_message** | Option<**String**> | LastCommitMessage is the message of the last commit that affected this file | [optional] +**last_commit_sha** | Option<**String**> | LastCommitSHA is the SHA of the last commit that affected this file | [optional] +**last_committer_date** | Option<**String**> | | [optional] +**lfs_oid** | Option<**String**> | LfsOid is the Git LFS object ID if this file is stored in LFS | [optional] +**lfs_size** | Option<**i64**> | LfsSize is the file size if this file is stored in LFS | [optional] +**name** | Option<**String**> | Name is the file or directory name | [optional] +**path** | Option<**String**> | Path is the full path to the file or directory | [optional] +**sha** | Option<**String**> | SHA is the Git blob or tree SHA | [optional] +**size** | Option<**i64**> | Size is the file size in bytes | [optional] **submodule_git_url** | Option<**String**> | `submodule_git_url` is populated when `type` is `submodule`, otherwise null | [optional] **target** | Option<**String**> | `target` is populated when `type` is `symlink`, otherwise null | [optional] **r#type** | Option<**String**> | `type` will be `file`, `dir`, `symlink`, or `submodule` | [optional] -**url** | Option<**String**> | | [optional] +**url** | Option<**String**> | URL is the API URL for this file or directory | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreateActionWorkflowDispatch.md b/crates/gitea-client/docs/CreateActionWorkflowDispatch.md new file mode 100644 index 0000000..667dc4c --- /dev/null +++ b/crates/gitea-client/docs/CreateActionWorkflowDispatch.md @@ -0,0 +1,12 @@ +# CreateActionWorkflowDispatch + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**inputs** | Option<**std::collections::HashMap**> | | [optional] +**r#ref** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/CreateBranchProtectionOption.md b/crates/gitea-client/docs/CreateBranchProtectionOption.md index 133926d..24413a8 100644 --- a/crates/gitea-client/docs/CreateBranchProtectionOption.md +++ b/crates/gitea-client/docs/CreateBranchProtectionOption.md @@ -6,19 +6,26 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **approvals_whitelist_teams** | Option<**Vec**> | | [optional] **approvals_whitelist_username** | Option<**Vec**> | | [optional] +**block_admin_merge_override** | Option<**bool**> | | [optional] **block_on_official_review_requests** | Option<**bool**> | | [optional] **block_on_outdated_branch** | Option<**bool**> | | [optional] **block_on_rejected_reviews** | Option<**bool**> | | [optional] **branch_name** | Option<**String**> | Deprecated: true | [optional] **dismiss_stale_approvals** | Option<**bool**> | | [optional] **enable_approvals_whitelist** | Option<**bool**> | | [optional] +**enable_force_push** | Option<**bool**> | | [optional] +**enable_force_push_allowlist** | Option<**bool**> | | [optional] **enable_merge_whitelist** | Option<**bool**> | | [optional] **enable_push** | Option<**bool**> | | [optional] **enable_push_whitelist** | Option<**bool**> | | [optional] **enable_status_check** | Option<**bool**> | | [optional] +**force_push_allowlist_deploy_keys** | Option<**bool**> | | [optional] +**force_push_allowlist_teams** | Option<**Vec**> | | [optional] +**force_push_allowlist_usernames** | Option<**Vec**> | | [optional] **ignore_stale_approvals** | Option<**bool**> | | [optional] **merge_whitelist_teams** | Option<**Vec**> | | [optional] **merge_whitelist_usernames** | Option<**Vec**> | | [optional] +**priority** | Option<**i64**> | | [optional] **protected_file_patterns** | Option<**String**> | | [optional] **push_whitelist_deploy_keys** | Option<**bool**> | | [optional] **push_whitelist_teams** | Option<**Vec**> | | [optional] diff --git a/crates/gitea-client/docs/CreateGpgKeyOption.md b/crates/gitea-client/docs/CreateGpgKeyOption.md index a96e002..d0c74d9 100644 --- a/crates/gitea-client/docs/CreateGpgKeyOption.md +++ b/crates/gitea-client/docs/CreateGpgKeyOption.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **armored_public_key** | **String** | An armored GPG key to add | -**armored_signature** | Option<**String**> | | [optional] +**armored_signature** | Option<**String**> | An optional armored signature for the GPG key | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreateHookOption.md b/crates/gitea-client/docs/CreateHookOption.md index f95ae41..b9698dc 100644 --- a/crates/gitea-client/docs/CreateHookOption.md +++ b/crates/gitea-client/docs/CreateHookOption.md @@ -5,11 +5,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **active** | Option<**bool**> | | [optional][default to false] -**authorization_header** | Option<**String**> | | [optional] -**branch_filter** | Option<**String**> | | [optional] +**authorization_header** | Option<**String**> | Authorization header to include in webhook requests | [optional] +**branch_filter** | Option<**String**> | Branch filter pattern to determine which branches trigger the webhook | [optional] **config** | **std::collections::HashMap** | CreateHookOptionConfig has all config options in it required are \"content_type\" and \"url\" Required | -**events** | Option<**Vec**> | | [optional] -**r#type** | **String** | | +**events** | Option<**Vec**> | List of events that will trigger this webhook | [optional] +**r#type** | **Type** | (enum: dingtalk, discord, gitea, gogs, msteams, slack, telegram, feishu, wechatwork, packagist) | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreateLabelOption.md b/crates/gitea-client/docs/CreateLabelOption.md index 4db4045..51f7bf1 100644 --- a/crates/gitea-client/docs/CreateLabelOption.md +++ b/crates/gitea-client/docs/CreateLabelOption.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **color** | **String** | | -**description** | Option<**String**> | | [optional] +**description** | Option<**String**> | Description provides additional context about the label's purpose | [optional] **exclusive** | Option<**bool**> | | [optional] **is_archived** | Option<**bool**> | | [optional] **name** | **String** | | diff --git a/crates/gitea-client/docs/CreateMilestoneOption.md b/crates/gitea-client/docs/CreateMilestoneOption.md index b00152e..05e4fb2 100644 --- a/crates/gitea-client/docs/CreateMilestoneOption.md +++ b/crates/gitea-client/docs/CreateMilestoneOption.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**description** | Option<**String**> | | [optional] +**description** | Option<**String**> | Description provides details about the milestone | [optional] **due_on** | Option<**String**> | | [optional] -**state** | Option<**String**> | | [optional] -**title** | Option<**String**> | | [optional] +**state** | Option<**State**> | (enum: open, closed) | [optional] +**title** | Option<**String**> | Title is the title of the new milestone | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreateOAuth2ApplicationOptions.md b/crates/gitea-client/docs/CreateOAuth2ApplicationOptions.md index da5608c..ae9a852 100644 --- a/crates/gitea-client/docs/CreateOAuth2ApplicationOptions.md +++ b/crates/gitea-client/docs/CreateOAuth2ApplicationOptions.md @@ -4,9 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**confidential_client** | Option<**bool**> | | [optional] -**name** | Option<**String**> | | [optional] -**redirect_uris** | Option<**Vec**> | | [optional] +**confidential_client** | Option<**bool**> | Whether the client is confidential | [optional] +**name** | Option<**String**> | The name of the OAuth2 application | [optional] +**redirect_uris** | Option<**Vec**> | The list of allowed redirect URIs | [optional] +**skip_secondary_authorization** | Option<**bool**> | Whether to skip secondary authorization | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreateOrUpdateSecretOption.md b/crates/gitea-client/docs/CreateOrUpdateSecretOption.md index 0bebb3d..4f44de7 100644 --- a/crates/gitea-client/docs/CreateOrUpdateSecretOption.md +++ b/crates/gitea-client/docs/CreateOrUpdateSecretOption.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **data** | **String** | Data of the secret to update | +**description** | Option<**String**> | Description of the secret to update | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreateOrgOption.md b/crates/gitea-client/docs/CreateOrgOption.md index 7104616..108e25f 100644 --- a/crates/gitea-client/docs/CreateOrgOption.md +++ b/crates/gitea-client/docs/CreateOrgOption.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**description** | Option<**String**> | | [optional] -**email** | Option<**String**> | | [optional] -**full_name** | Option<**String**> | | [optional] -**location** | Option<**String**> | | [optional] -**repo_admin_change_team_access** | Option<**bool**> | | [optional] -**username** | **String** | | -**visibility** | Option<**String**> | possible values are `public` (default), `limited` or `private` | [optional] -**website** | Option<**String**> | | [optional] +**description** | Option<**String**> | The description of the organization | [optional] +**email** | Option<**String**> | The email address of the organization | [optional] +**full_name** | Option<**String**> | The full display name of the organization | [optional] +**location** | Option<**String**> | The location of the organization | [optional] +**repo_admin_change_team_access** | Option<**bool**> | Whether repository administrators can change team access | [optional] +**username** | **String** | username of the organization | +**visibility** | Option<**Visibility**> | possible values are `public` (default), `limited` or `private` (enum: public, limited, private) | [optional] +**website** | Option<**String**> | The website URL of the organization | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreatePullRequestOption.md b/crates/gitea-client/docs/CreatePullRequestOption.md index 1028806..735f917 100644 --- a/crates/gitea-client/docs/CreatePullRequestOption.md +++ b/crates/gitea-client/docs/CreatePullRequestOption.md @@ -4,15 +4,17 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**assignee** | Option<**String**> | | [optional] -**assignees** | Option<**Vec**> | | [optional] -**base** | Option<**String**> | | [optional] -**body** | Option<**String**> | | [optional] +**assignee** | Option<**String**> | The primary assignee username | [optional] +**assignees** | Option<**Vec**> | The list of assignee usernames | [optional] +**base** | Option<**String**> | The base branch for the pull request | [optional] +**body** | Option<**String**> | The description body of the pull request | [optional] **due_date** | Option<**String**> | | [optional] -**head** | Option<**String**> | | [optional] -**labels** | Option<**Vec**> | | [optional] -**milestone** | Option<**i64**> | | [optional] -**title** | Option<**String**> | | [optional] +**head** | Option<**String**> | The head branch for the pull request, it could be a branch name on the base repository or a form like `:` which refers to the user's fork repository's branch. | [optional] +**labels** | Option<**Vec**> | The list of label IDs to assign to the pull request | [optional] +**milestone** | Option<**i64**> | The milestone ID to assign to the pull request | [optional] +**reviewers** | Option<**Vec**> | The list of reviewer usernames | [optional] +**team_reviewers** | Option<**Vec**> | The list of team reviewer names | [optional] +**title** | Option<**String**> | The title of the pull request | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreatePushMirrorOption.md b/crates/gitea-client/docs/CreatePushMirrorOption.md index d281d8a..1782fd2 100644 --- a/crates/gitea-client/docs/CreatePushMirrorOption.md +++ b/crates/gitea-client/docs/CreatePushMirrorOption.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**interval** | Option<**String**> | | [optional] -**remote_address** | Option<**String**> | | [optional] -**remote_password** | Option<**String**> | | [optional] -**remote_username** | Option<**String**> | | [optional] -**sync_on_commit** | Option<**bool**> | | [optional] +**interval** | Option<**String**> | The sync interval for automatic updates | [optional] +**remote_address** | Option<**String**> | The remote repository URL to push to | [optional] +**remote_password** | Option<**String**> | The password for authentication with the remote repository | [optional] +**remote_username** | Option<**String**> | The username for authentication with the remote repository | [optional] +**sync_on_commit** | Option<**bool**> | Whether to sync on every commit | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreateReleaseOption.md b/crates/gitea-client/docs/CreateReleaseOption.md index 309884b..8a6a344 100644 --- a/crates/gitea-client/docs/CreateReleaseOption.md +++ b/crates/gitea-client/docs/CreateReleaseOption.md @@ -4,12 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**body** | Option<**String**> | | [optional] -**draft** | Option<**bool**> | | [optional] -**name** | Option<**String**> | | [optional] -**prerelease** | Option<**bool**> | | [optional] +**body** | Option<**String**> | The release notes or description | [optional] +**draft** | Option<**bool**> | Whether to create the release as a draft | [optional] +**name** | Option<**String**> | The display title of the release | [optional] +**prerelease** | Option<**bool**> | Whether to mark the release as a prerelease | [optional] +**tag_message** | Option<**String**> | The message for the git tag | [optional] **tag_name** | **String** | | -**target_commitish** | Option<**String**> | | [optional] +**target_commitish** | Option<**String**> | The target commitish for the release | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreateRepoOption.md b/crates/gitea-client/docs/CreateRepoOption.md index ea07ca1..09763cc 100644 --- a/crates/gitea-client/docs/CreateRepoOption.md +++ b/crates/gitea-client/docs/CreateRepoOption.md @@ -11,11 +11,11 @@ Name | Type | Description | Notes **issue_labels** | Option<**String**> | Label-Set to use | [optional] **license** | Option<**String**> | License to use | [optional] **name** | **String** | Name of the repository to create | -**object_format_name** | Option<**String**> | ObjectFormatName of the underlying git repository | [optional] +**object_format_name** | Option<**ObjectFormatName**> | ObjectFormatName of the underlying git repository (enum: sha1, sha256) | [optional] **private** | Option<**bool**> | Whether the repository is private | [optional] **readme** | Option<**String**> | Readme of the repository to create | [optional] **template** | Option<**bool**> | Whether the repository is template | [optional] -**trust_model** | Option<**String**> | TrustModel of the repository | [optional] +**trust_model** | Option<**TrustModel**> | TrustModel of the repository (enum: default, collaborator, committer, collaboratorcommitter) | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreateStatusOption.md b/crates/gitea-client/docs/CreateStatusOption.md index 67f6f08..c3b55e8 100644 --- a/crates/gitea-client/docs/CreateStatusOption.md +++ b/crates/gitea-client/docs/CreateStatusOption.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**context** | Option<**String**> | | [optional] -**description** | Option<**String**> | | [optional] -**state** | Option<**String**> | CommitStatusState holds the state of a CommitStatus It can be \"pending\", \"success\", \"error\" and \"failure\" | [optional] -**target_url** | Option<**String**> | | [optional] +**context** | Option<**String**> | Context is the unique context identifier for the status | [optional] +**description** | Option<**String**> | Description provides a brief description of the status | [optional] +**state** | Option<**State**> | State represents the status state to set (pending, success, error, failure) pending CommitStatusPending CommitStatusPending is for when the CommitStatus is Pending success CommitStatusSuccess CommitStatusSuccess is for when the CommitStatus is Success error CommitStatusError CommitStatusError is for when the CommitStatus is Error failure CommitStatusFailure CommitStatusFailure is for when the CommitStatus is Failure warning CommitStatusWarning CommitStatusWarning is for when the CommitStatus is Warning skipped CommitStatusSkipped CommitStatusSkipped is for when CommitStatus is Skipped (enum: pending, success, error, failure, warning, skipped) | [optional] +**target_url** | Option<**String**> | TargetURL is the URL to link to for more details | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreateTagOption.md b/crates/gitea-client/docs/CreateTagOption.md index 475f578..59f11be 100644 --- a/crates/gitea-client/docs/CreateTagOption.md +++ b/crates/gitea-client/docs/CreateTagOption.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**message** | Option<**String**> | | [optional] +**message** | Option<**String**> | The message to associate with the tag | [optional] **tag_name** | **String** | | -**target** | Option<**String**> | | [optional] +**target** | Option<**String**> | The target commit SHA or branch name for the tag | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreateTagProtectionOption.md b/crates/gitea-client/docs/CreateTagProtectionOption.md new file mode 100644 index 0000000..6d57fa6 --- /dev/null +++ b/crates/gitea-client/docs/CreateTagProtectionOption.md @@ -0,0 +1,13 @@ +# CreateTagProtectionOption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name_pattern** | Option<**String**> | The pattern to match tag names for protection | [optional] +**whitelist_teams** | Option<**Vec**> | List of team names allowed to create/delete protected tags | [optional] +**whitelist_usernames** | Option<**Vec**> | List of usernames allowed to create/delete protected tags | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/CreateTeamOption.md b/crates/gitea-client/docs/CreateTeamOption.md index 32db621..5740785 100644 --- a/crates/gitea-client/docs/CreateTeamOption.md +++ b/crates/gitea-client/docs/CreateTeamOption.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**can_create_org_repo** | Option<**bool**> | | [optional] -**description** | Option<**String**> | | [optional] -**includes_all_repositories** | Option<**bool**> | | [optional] +**can_create_org_repo** | Option<**bool**> | Whether the team can create repositories in the organization | [optional] +**description** | Option<**String**> | The description of the team | [optional] +**includes_all_repositories** | Option<**bool**> | Whether the team has access to all repositories in the organization | [optional] **name** | **String** | | -**permission** | Option<**String**> | | [optional] +**permission** | Option<**Permission**> | (enum: read, write, admin) | [optional] **units** | Option<**Vec**> | | [optional] **units_map** | Option<**std::collections::HashMap**> | | [optional] diff --git a/crates/gitea-client/docs/CreateUserOption.md b/crates/gitea-client/docs/CreateUserOption.md index 56b0d9d..dc633c6 100644 --- a/crates/gitea-client/docs/CreateUserOption.md +++ b/crates/gitea-client/docs/CreateUserOption.md @@ -6,15 +6,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | Option<**String**> | For explicitly setting the user creation timestamp. Useful when users are migrated from other systems. When omitted, the user's creation timestamp will be set to \"now\". | [optional] **email** | **String** | | -**full_name** | Option<**String**> | | [optional] -**login_name** | Option<**String**> | | [optional] -**must_change_password** | Option<**bool**> | | [optional] -**password** | Option<**String**> | | [optional] -**restricted** | Option<**bool**> | | [optional] -**send_notify** | Option<**bool**> | | [optional] -**source_id** | Option<**i64**> | | [optional] -**username** | **String** | | -**visibility** | Option<**String**> | | [optional] +**full_name** | Option<**String**> | The full display name of the user | [optional] +**login_name** | Option<**String**> | identifier of the user, provided by the external authenticator (if configured) | [optional][default to empty] +**must_change_password** | Option<**bool**> | Whether the user must change password on first login | [optional] +**password** | Option<**String**> | The plain text password for the user | [optional] +**restricted** | Option<**bool**> | Whether the user has restricted access privileges | [optional] +**send_notify** | Option<**bool**> | Whether to send welcome notification email to the user | [optional] +**source_id** | Option<**i64**> | The authentication source ID to associate with the user | [optional] +**username** | **String** | username of the user | +**visibility** | Option<**String**> | User visibility level: public, limited, or private | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/CreateVariableOption.md b/crates/gitea-client/docs/CreateVariableOption.md index efce49f..c7159de 100644 --- a/crates/gitea-client/docs/CreateVariableOption.md +++ b/crates/gitea-client/docs/CreateVariableOption.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**description** | Option<**String**> | Description of the variable to create | [optional] **value** | **String** | Value of the variable to create | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Cron.md b/crates/gitea-client/docs/Cron.md index 5fc02c3..a0822c6 100644 --- a/crates/gitea-client/docs/Cron.md +++ b/crates/gitea-client/docs/Cron.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**exec_times** | Option<**i64**> | | [optional] -**name** | Option<**String**> | | [optional] -**next** | Option<**String**> | | [optional] -**prev** | Option<**String**> | | [optional] -**schedule** | Option<**String**> | | [optional] +**exec_times** | Option<**i64**> | The total number of times this cron task has been executed | [optional] +**name** | Option<**String**> | The name of the cron task | [optional] +**next** | Option<**String**> | The next scheduled execution time | [optional] +**prev** | Option<**String**> | The previous execution time | [optional] +**schedule** | Option<**String**> | The cron schedule expression (e.g., \"0 0 * * *\") | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/DeleteFileOptions.md b/crates/gitea-client/docs/DeleteFileOptions.md index c17bdc5..4110db0 100644 --- a/crates/gitea-client/docs/DeleteFileOptions.md +++ b/crates/gitea-client/docs/DeleteFileOptions.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **dates** | Option<[**models::CommitDateOptions**](CommitDateOptions.md)> | | [optional] **message** | Option<**String**> | message (optional) for the commit of this file. if not supplied, a default message will be used | [optional] **new_branch** | Option<**String**> | new_branch (optional) will make a new branch from `branch` before creating the file | [optional] -**sha** | **String** | sha is the SHA for the file that already exists | +**sha** | **String** | the blob ID (SHA) for the file that already exists, it is required for changing existing files | **signoff** | Option<**bool**> | Add a Signed-off-by trailer by the committer at the end of the commit log message. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/DeployKey.md b/crates/gitea-client/docs/DeployKey.md index 8167696..fa74416 100644 --- a/crates/gitea-client/docs/DeployKey.md +++ b/crates/gitea-client/docs/DeployKey.md @@ -5,14 +5,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | Option<**String**> | | [optional] -**fingerprint** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**key** | Option<**String**> | | [optional] -**key_id** | Option<**i64**> | | [optional] -**read_only** | Option<**bool**> | | [optional] +**fingerprint** | Option<**String**> | Fingerprint is the key's fingerprint | [optional] +**id** | Option<**i64**> | ID is the unique identifier for the deploy key | [optional] +**key** | Option<**String**> | Key contains the actual SSH key content | [optional] +**key_id** | Option<**i64**> | KeyID is the associated public key ID | [optional] +**read_only** | Option<**bool**> | ReadOnly indicates if the key has read-only access | [optional] **repository** | Option<[**models::Repository**](Repository.md)> | | [optional] -**title** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**title** | Option<**String**> | Title is the human-readable name for the key | [optional] +**url** | Option<**String**> | URL is the API URL for this deploy key | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/EditAttachmentOptions.md b/crates/gitea-client/docs/EditAttachmentOptions.md index 7d1d0ad..cfd6e8e 100644 --- a/crates/gitea-client/docs/EditAttachmentOptions.md +++ b/crates/gitea-client/docs/EditAttachmentOptions.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | Option<**String**> | | [optional] +**name** | Option<**String**> | Name is the new filename for the attachment | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/EditBranchProtectionOption.md b/crates/gitea-client/docs/EditBranchProtectionOption.md index f48254a..c7a029a 100644 --- a/crates/gitea-client/docs/EditBranchProtectionOption.md +++ b/crates/gitea-client/docs/EditBranchProtectionOption.md @@ -6,18 +6,25 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **approvals_whitelist_teams** | Option<**Vec**> | | [optional] **approvals_whitelist_username** | Option<**Vec**> | | [optional] +**block_admin_merge_override** | Option<**bool**> | | [optional] **block_on_official_review_requests** | Option<**bool**> | | [optional] **block_on_outdated_branch** | Option<**bool**> | | [optional] **block_on_rejected_reviews** | Option<**bool**> | | [optional] **dismiss_stale_approvals** | Option<**bool**> | | [optional] **enable_approvals_whitelist** | Option<**bool**> | | [optional] +**enable_force_push** | Option<**bool**> | | [optional] +**enable_force_push_allowlist** | Option<**bool**> | | [optional] **enable_merge_whitelist** | Option<**bool**> | | [optional] **enable_push** | Option<**bool**> | | [optional] **enable_push_whitelist** | Option<**bool**> | | [optional] **enable_status_check** | Option<**bool**> | | [optional] +**force_push_allowlist_deploy_keys** | Option<**bool**> | | [optional] +**force_push_allowlist_teams** | Option<**Vec**> | | [optional] +**force_push_allowlist_usernames** | Option<**Vec**> | | [optional] **ignore_stale_approvals** | Option<**bool**> | | [optional] **merge_whitelist_teams** | Option<**Vec**> | | [optional] **merge_whitelist_usernames** | Option<**Vec**> | | [optional] +**priority** | Option<**i64**> | | [optional] **protected_file_patterns** | Option<**String**> | | [optional] **push_whitelist_deploy_keys** | Option<**bool**> | | [optional] **push_whitelist_teams** | Option<**Vec**> | | [optional] diff --git a/crates/gitea-client/docs/EditGitHookOption.md b/crates/gitea-client/docs/EditGitHookOption.md index 01bd2a8..1af2947 100644 --- a/crates/gitea-client/docs/EditGitHookOption.md +++ b/crates/gitea-client/docs/EditGitHookOption.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**content** | Option<**String**> | | [optional] +**content** | Option<**String**> | Content is the new script content for the hook | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/EditHookOption.md b/crates/gitea-client/docs/EditHookOption.md index f62d9ce..70ab63b 100644 --- a/crates/gitea-client/docs/EditHookOption.md +++ b/crates/gitea-client/docs/EditHookOption.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**active** | Option<**bool**> | | [optional] -**authorization_header** | Option<**String**> | | [optional] -**branch_filter** | Option<**String**> | | [optional] -**config** | Option<**std::collections::HashMap**> | | [optional] -**events** | Option<**Vec**> | | [optional] +**active** | Option<**bool**> | Whether the webhook is active and will be triggered | [optional] +**authorization_header** | Option<**String**> | Authorization header to include in webhook requests | [optional] +**branch_filter** | Option<**String**> | Branch filter pattern to determine which branches trigger the webhook | [optional] +**config** | Option<**std::collections::HashMap**> | Configuration settings for the webhook | [optional] +**events** | Option<**Vec**> | List of events that trigger this webhook | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/EditLabelOption.md b/crates/gitea-client/docs/EditLabelOption.md index 6385abe..789e443 100644 --- a/crates/gitea-client/docs/EditLabelOption.md +++ b/crates/gitea-client/docs/EditLabelOption.md @@ -5,10 +5,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **color** | Option<**String**> | | [optional] -**description** | Option<**String**> | | [optional] +**description** | Option<**String**> | Description provides additional context about the label's purpose | [optional] **exclusive** | Option<**bool**> | | [optional] **is_archived** | Option<**bool**> | | [optional] -**name** | Option<**String**> | | [optional] +**name** | Option<**String**> | Name is the new display name for the label | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/EditMilestoneOption.md b/crates/gitea-client/docs/EditMilestoneOption.md index e266c1c..0cda181 100644 --- a/crates/gitea-client/docs/EditMilestoneOption.md +++ b/crates/gitea-client/docs/EditMilestoneOption.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**description** | Option<**String**> | | [optional] -**due_on** | Option<**String**> | | [optional] -**state** | Option<**String**> | | [optional] -**title** | Option<**String**> | | [optional] +**description** | Option<**String**> | Description provides updated details about the milestone | [optional] +**due_on** | Option<**String**> | Deadline is the updated due date for the milestone | [optional] +**state** | Option<**String**> | State indicates the updated state of the milestone | [optional] +**title** | Option<**String**> | Title is the updated title of the milestone | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/EditOrgOption.md b/crates/gitea-client/docs/EditOrgOption.md index 28417e7..d08cb88 100644 --- a/crates/gitea-client/docs/EditOrgOption.md +++ b/crates/gitea-client/docs/EditOrgOption.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**description** | Option<**String**> | | [optional] -**email** | Option<**String**> | | [optional] -**full_name** | Option<**String**> | | [optional] -**location** | Option<**String**> | | [optional] -**repo_admin_change_team_access** | Option<**bool**> | | [optional] -**visibility** | Option<**String**> | possible values are `public`, `limited` or `private` | [optional] -**website** | Option<**String**> | | [optional] +**description** | Option<**String**> | The description of the organization | [optional] +**email** | Option<**String**> | The email address of the organization | [optional] +**full_name** | Option<**String**> | The full display name of the organization | [optional] +**location** | Option<**String**> | The location of the organization | [optional] +**repo_admin_change_team_access** | Option<**bool**> | Whether repository administrators can change team access | [optional] +**visibility** | Option<**Visibility**> | possible values are `public`, `limited` or `private` (enum: public, limited, private) | [optional] +**website** | Option<**String**> | The website URL of the organization | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/EditPullRequestOption.md b/crates/gitea-client/docs/EditPullRequestOption.md index fe31231..bd5d71b 100644 --- a/crates/gitea-client/docs/EditPullRequestOption.md +++ b/crates/gitea-client/docs/EditPullRequestOption.md @@ -4,17 +4,17 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**allow_maintainer_edit** | Option<**bool**> | | [optional] -**assignee** | Option<**String**> | | [optional] -**assignees** | Option<**Vec**> | | [optional] -**base** | Option<**String**> | | [optional] -**body** | Option<**String**> | | [optional] +**allow_maintainer_edit** | Option<**bool**> | Whether to allow maintainer edits | [optional] +**assignee** | Option<**String**> | The new primary assignee username | [optional] +**assignees** | Option<**Vec**> | The new list of assignee usernames | [optional] +**base** | Option<**String**> | The new base branch for the pull request | [optional] +**body** | Option<**String**> | The new description body for the pull request | [optional] **due_date** | Option<**String**> | | [optional] -**labels** | Option<**Vec**> | | [optional] -**milestone** | Option<**i64**> | | [optional] -**state** | Option<**String**> | | [optional] -**title** | Option<**String**> | | [optional] -**unset_due_date** | Option<**bool**> | | [optional] +**labels** | Option<**Vec**> | The new list of label IDs for the pull request | [optional] +**milestone** | Option<**i64**> | The new milestone ID for the pull request | [optional] +**state** | Option<**String**> | The new state for the pull request | [optional] +**title** | Option<**String**> | The new title for the pull request | [optional] +**unset_due_date** | Option<**bool**> | Whether to remove the current deadline | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/EditReactionOption.md b/crates/gitea-client/docs/EditReactionOption.md index 6f01410..3da067e 100644 --- a/crates/gitea-client/docs/EditReactionOption.md +++ b/crates/gitea-client/docs/EditReactionOption.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**content** | Option<**String**> | | [optional] +**content** | Option<**String**> | The reaction content (e.g., emoji or reaction type) | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/EditReleaseOption.md b/crates/gitea-client/docs/EditReleaseOption.md index 308e111..3f9551f 100644 --- a/crates/gitea-client/docs/EditReleaseOption.md +++ b/crates/gitea-client/docs/EditReleaseOption.md @@ -4,12 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**body** | Option<**String**> | | [optional] -**draft** | Option<**bool**> | | [optional] -**name** | Option<**String**> | | [optional] -**prerelease** | Option<**bool**> | | [optional] -**tag_name** | Option<**String**> | | [optional] -**target_commitish** | Option<**String**> | | [optional] +**body** | Option<**String**> | The new release notes or description | [optional] +**draft** | Option<**bool**> | Whether to change the draft status | [optional] +**name** | Option<**String**> | The new display title of the release | [optional] +**prerelease** | Option<**bool**> | Whether to change the prerelease status | [optional] +**tag_name** | Option<**String**> | The new name of the git tag | [optional] +**target_commitish** | Option<**String**> | The new target commitish for the release | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/EditRepoOption.md b/crates/gitea-client/docs/EditRepoOption.md index 590383c..f1c6d11 100644 --- a/crates/gitea-client/docs/EditRepoOption.md +++ b/crates/gitea-client/docs/EditRepoOption.md @@ -22,6 +22,7 @@ Name | Type | Description | Notes **external_tracker** | Option<[**models::ExternalTracker**](ExternalTracker.md)> | | [optional] **external_wiki** | Option<[**models::ExternalWiki**](ExternalWiki.md)> | | [optional] **has_actions** | Option<**bool**> | either `true` to enable actions unit, or `false` to disable them. | [optional] +**has_code** | Option<**bool**> | either `true` to enable code for this repository or `false` to disable it. | [optional] **has_issues** | Option<**bool**> | either `true` to enable issues for this repository or `false` to disable them. | [optional] **has_packages** | Option<**bool**> | either `true` to enable packages unit, or `false` to disable them. | [optional] **has_projects** | Option<**bool**> | either `true` to enable project unit, or `false` to disable them. | [optional] diff --git a/crates/gitea-client/docs/EditTagProtectionOption.md b/crates/gitea-client/docs/EditTagProtectionOption.md new file mode 100644 index 0000000..1639f9d --- /dev/null +++ b/crates/gitea-client/docs/EditTagProtectionOption.md @@ -0,0 +1,13 @@ +# EditTagProtectionOption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name_pattern** | Option<**String**> | The pattern to match tag names for protection | [optional] +**whitelist_teams** | Option<**Vec**> | List of team names allowed to create/delete protected tags | [optional] +**whitelist_usernames** | Option<**Vec**> | List of usernames allowed to create/delete protected tags | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/EditTeamOption.md b/crates/gitea-client/docs/EditTeamOption.md index 9e83333..4be3576 100644 --- a/crates/gitea-client/docs/EditTeamOption.md +++ b/crates/gitea-client/docs/EditTeamOption.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**can_create_org_repo** | Option<**bool**> | | [optional] -**description** | Option<**String**> | | [optional] -**includes_all_repositories** | Option<**bool**> | | [optional] +**can_create_org_repo** | Option<**bool**> | Whether the team can create repositories in the organization | [optional] +**description** | Option<**String**> | The description of the team | [optional] +**includes_all_repositories** | Option<**bool**> | Whether the team has access to all repositories in the organization | [optional] **name** | **String** | | -**permission** | Option<**String**> | | [optional] +**permission** | Option<**Permission**> | (enum: read, write, admin) | [optional] **units** | Option<**Vec**> | | [optional] **units_map** | Option<**std::collections::HashMap**> | | [optional] diff --git a/crates/gitea-client/docs/EditUserOption.md b/crates/gitea-client/docs/EditUserOption.md index 0d6bf67..140af7c 100644 --- a/crates/gitea-client/docs/EditUserOption.md +++ b/crates/gitea-client/docs/EditUserOption.md @@ -4,24 +4,24 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**active** | Option<**bool**> | | [optional] -**admin** | Option<**bool**> | | [optional] -**allow_create_organization** | Option<**bool**> | | [optional] -**allow_git_hook** | Option<**bool**> | | [optional] -**allow_import_local** | Option<**bool**> | | [optional] -**description** | Option<**String**> | | [optional] +**active** | Option<**bool**> | Whether the user account is active | [optional] +**admin** | Option<**bool**> | Whether the user has administrator privileges | [optional] +**allow_create_organization** | Option<**bool**> | Whether the user can create organizations | [optional] +**allow_git_hook** | Option<**bool**> | Whether the user can use Git hooks | [optional] +**allow_import_local** | Option<**bool**> | Whether the user can import local repositories | [optional] +**description** | Option<**String**> | The user's personal description or bio | [optional] **email** | Option<**String**> | | [optional] -**full_name** | Option<**String**> | | [optional] -**location** | Option<**String**> | | [optional] -**login_name** | **String** | | -**max_repo_creation** | Option<**i64**> | | [optional] -**must_change_password** | Option<**bool**> | | [optional] -**password** | Option<**String**> | | [optional] -**prohibit_login** | Option<**bool**> | | [optional] -**restricted** | Option<**bool**> | | [optional] +**full_name** | Option<**String**> | The full display name of the user | [optional] +**location** | Option<**String**> | The user's location or address | [optional] +**login_name** | **String** | identifier of the user, provided by the external authenticator (if configured) | [default to empty] +**max_repo_creation** | Option<**i64**> | Maximum number of repositories the user can create | [optional] +**must_change_password** | Option<**bool**> | Whether the user must change password on next login | [optional] +**password** | Option<**String**> | The plain text password for the user | [optional] +**prohibit_login** | Option<**bool**> | Whether the user is prohibited from logging in | [optional] +**restricted** | Option<**bool**> | Whether the user has restricted access privileges | [optional] **source_id** | **i64** | | -**visibility** | Option<**String**> | | [optional] -**website** | Option<**String**> | | [optional] +**visibility** | Option<**String**> | User visibility level: public, limited, or private | [optional] +**website** | Option<**String**> | The user's personal website URL | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Email.md b/crates/gitea-client/docs/Email.md index 0b0d7f7..13dd3f2 100644 --- a/crates/gitea-client/docs/Email.md +++ b/crates/gitea-client/docs/Email.md @@ -5,10 +5,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **email** | Option<**String**> | | [optional] -**primary** | Option<**bool**> | | [optional] -**user_id** | Option<**i64**> | | [optional] -**username** | Option<**String**> | | [optional] -**verified** | Option<**bool**> | | [optional] +**primary** | Option<**bool**> | Whether this is the primary email address | [optional] +**user_id** | Option<**i64**> | The unique identifier of the user who owns this email | [optional] +**username** | Option<**String**> | username of the user | [optional] +**verified** | Option<**bool**> | Whether the email address has been verified | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/FileCommitResponse.md b/crates/gitea-client/docs/FileCommitResponse.md index 300ca9f..0734f0c 100644 --- a/crates/gitea-client/docs/FileCommitResponse.md +++ b/crates/gitea-client/docs/FileCommitResponse.md @@ -7,12 +7,12 @@ Name | Type | Description | Notes **author** | Option<[**models::CommitUser**](CommitUser.md)> | | [optional] **committer** | Option<[**models::CommitUser**](CommitUser.md)> | | [optional] **created** | Option<**String**> | | [optional] -**html_url** | Option<**String**> | | [optional] -**message** | Option<**String**> | | [optional] -**parents** | Option<[**Vec**](CommitMeta.md)> | | [optional] -**sha** | Option<**String**> | | [optional] +**html_url** | Option<**String**> | HTMLURL is the web URL for viewing this commit | [optional] +**message** | Option<**String**> | Message is the commit message | [optional] +**parents** | Option<[**Vec**](CommitMeta.md)> | Parents contains parent commit metadata | [optional] +**sha** | Option<**String**> | SHA is the commit SHA hash | [optional] **tree** | Option<[**models::CommitMeta**](CommitMeta.md)> | | [optional] -**url** | Option<**String**> | | [optional] +**url** | Option<**String**> | URL is the API URL for the commit | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/FileDeleteResponse.md b/crates/gitea-client/docs/FileDeleteResponse.md index ddef405..302b380 100644 --- a/crates/gitea-client/docs/FileDeleteResponse.md +++ b/crates/gitea-client/docs/FileDeleteResponse.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **commit** | Option<[**models::FileCommitResponse**](FileCommitResponse.md)> | | [optional] -**content** | Option<[**serde_json::Value**](.md)> | | [optional] +**content** | Option<**serde_json::Value**> | Content is always null for delete operations | [optional] **verification** | Option<[**models::PayloadCommitVerification**](PayloadCommitVerification.md)> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/FileLinksResponse.md b/crates/gitea-client/docs/FileLinksResponse.md index c6f1372..85cc77f 100644 --- a/crates/gitea-client/docs/FileLinksResponse.md +++ b/crates/gitea-client/docs/FileLinksResponse.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**git** | Option<**String**> | | [optional] -**html** | Option<**String**> | | [optional] -**param_self** | Option<**String**> | | [optional] +**git** | Option<**String**> | GitURL is the Git API URL for this file | [optional] +**html** | Option<**String**> | HTMLURL is the web URL for this file | [optional] +**param_self** | Option<**String**> | Self is the API URL for this file | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/FilesResponse.md b/crates/gitea-client/docs/FilesResponse.md index cd78f4a..0f8e472 100644 --- a/crates/gitea-client/docs/FilesResponse.md +++ b/crates/gitea-client/docs/FilesResponse.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **commit** | Option<[**models::FileCommitResponse**](FileCommitResponse.md)> | | [optional] -**files** | Option<[**Vec**](ContentsResponse.md)> | | [optional] +**files** | Option<[**Vec**](ContentsResponse.md)> | Files contains the list of file contents and metadata | [optional] **verification** | Option<[**models::PayloadCommitVerification**](PayloadCommitVerification.md)> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/GeneralApiSettings.md b/crates/gitea-client/docs/GeneralApiSettings.md index 70a12c7..ab747c6 100644 --- a/crates/gitea-client/docs/GeneralApiSettings.md +++ b/crates/gitea-client/docs/GeneralApiSettings.md @@ -4,10 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**default_git_trees_per_page** | Option<**i64**> | | [optional] -**default_max_blob_size** | Option<**i64**> | | [optional] -**default_paging_num** | Option<**i64**> | | [optional] -**max_response_items** | Option<**i64**> | | [optional] +**default_git_trees_per_page** | Option<**i64**> | DefaultGitTreesPerPage is the default number of Git tree items per page | [optional] +**default_max_blob_size** | Option<**i64**> | DefaultMaxBlobSize is the default maximum blob size for API responses | [optional] +**default_max_response_size** | Option<**i64**> | DefaultMaxResponseSize is the default maximum response size | [optional] +**default_paging_num** | Option<**i64**> | DefaultPagingNum is the default number of items per page | [optional] +**max_response_items** | Option<**i64**> | MaxResponseItems is the maximum number of items returned in API responses | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/GeneralAttachmentSettings.md b/crates/gitea-client/docs/GeneralAttachmentSettings.md index 3597dc2..2819152 100644 --- a/crates/gitea-client/docs/GeneralAttachmentSettings.md +++ b/crates/gitea-client/docs/GeneralAttachmentSettings.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**allowed_types** | Option<**String**> | | [optional] -**enabled** | Option<**bool**> | | [optional] -**max_files** | Option<**i64**> | | [optional] -**max_size** | Option<**i64**> | | [optional] +**allowed_types** | Option<**String**> | AllowedTypes contains the allowed file types for attachments | [optional] +**enabled** | Option<**bool**> | Enabled indicates if file attachments are enabled | [optional] +**max_files** | Option<**i64**> | MaxFiles is the maximum number of files per attachment | [optional] +**max_size** | Option<**i64**> | MaxSize is the maximum size for individual attachments | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/GeneralRepoSettings.md b/crates/gitea-client/docs/GeneralRepoSettings.md index 394608c..772511b 100644 --- a/crates/gitea-client/docs/GeneralRepoSettings.md +++ b/crates/gitea-client/docs/GeneralRepoSettings.md @@ -4,12 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**http_git_disabled** | Option<**bool**> | | [optional] -**lfs_disabled** | Option<**bool**> | | [optional] -**migrations_disabled** | Option<**bool**> | | [optional] -**mirrors_disabled** | Option<**bool**> | | [optional] -**stars_disabled** | Option<**bool**> | | [optional] -**time_tracking_disabled** | Option<**bool**> | | [optional] +**http_git_disabled** | Option<**bool**> | HTTPGitDisabled indicates if HTTP Git operations are disabled | [optional] +**lfs_disabled** | Option<**bool**> | LFSDisabled indicates if Git LFS support is disabled | [optional] +**migrations_disabled** | Option<**bool**> | MigrationsDisabled indicates if repository migrations are disabled | [optional] +**mirrors_disabled** | Option<**bool**> | MirrorsDisabled indicates if repository mirroring is disabled | [optional] +**stars_disabled** | Option<**bool**> | StarsDisabled indicates if repository starring is disabled | [optional] +**time_tracking_disabled** | Option<**bool**> | TimeTrackingDisabled indicates if time tracking is disabled | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/GeneralUiSettings.md b/crates/gitea-client/docs/GeneralUiSettings.md index bdec13d..b136f58 100644 --- a/crates/gitea-client/docs/GeneralUiSettings.md +++ b/crates/gitea-client/docs/GeneralUiSettings.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**allowed_reactions** | Option<**Vec**> | | [optional] -**custom_emojis** | Option<**Vec**> | | [optional] -**default_theme** | Option<**String**> | | [optional] +**allowed_reactions** | Option<**Vec**> | AllowedReactions contains the list of allowed emoji reactions | [optional] +**custom_emojis** | Option<**Vec**> | CustomEmojis contains the list of custom emojis | [optional] +**default_theme** | Option<**String**> | DefaultTheme is the default UI theme | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/GenerateRepoOption.md b/crates/gitea-client/docs/GenerateRepoOption.md index 997d4ef..58c2734 100644 --- a/crates/gitea-client/docs/GenerateRepoOption.md +++ b/crates/gitea-client/docs/GenerateRepoOption.md @@ -10,8 +10,8 @@ Name | Type | Description | Notes **git_content** | Option<**bool**> | include git content of default branch in template repo | [optional] **git_hooks** | Option<**bool**> | include git hooks in template repo | [optional] **labels** | Option<**bool**> | include labels in template repo | [optional] -**name** | **String** | Name of the repository to create | -**owner** | **String** | The organization or person who will own the new repository | +**name** | **String** | | +**owner** | **String** | the organization's name or individual user's name who will own the new repository | **private** | Option<**bool**> | Whether the repository is private | [optional] **protected_branch** | Option<**bool**> | include protected branches in template repo | [optional] **topics** | Option<**bool**> | include topics in template repo | [optional] diff --git a/crates/gitea-client/docs/GetFilesOptions.md b/crates/gitea-client/docs/GetFilesOptions.md new file mode 100644 index 0000000..1ca6d98 --- /dev/null +++ b/crates/gitea-client/docs/GetFilesOptions.md @@ -0,0 +1,11 @@ +# GetFilesOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**files** | Option<**Vec**> | Files is the list of file paths to retrieve | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/GitBlobResponse.md b/crates/gitea-client/docs/GitBlobResponse.md index ff50f38..55c1018 100644 --- a/crates/gitea-client/docs/GitBlobResponse.md +++ b/crates/gitea-client/docs/GitBlobResponse.md @@ -4,11 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**content** | Option<**String**> | | [optional] -**encoding** | Option<**String**> | | [optional] -**sha** | Option<**String**> | | [optional] -**size** | Option<**i64**> | | [optional] -**url** | Option<**String**> | | [optional] +**content** | Option<**String**> | The content of the git blob (may be base64 encoded) | [optional] +**encoding** | Option<**String**> | The encoding used for the content (e.g., \"base64\") | [optional] +**lfs_oid** | Option<**String**> | The LFS object ID if this blob is stored in LFS | [optional] +**lfs_size** | Option<**i64**> | The size of the LFS object if this blob is stored in LFS | [optional] +**sha** | Option<**String**> | The SHA hash of the git blob | [optional] +**size** | Option<**i64**> | The size of the git blob in bytes | [optional] +**url** | Option<**String**> | The URL to access this git blob | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/GitEntry.md b/crates/gitea-client/docs/GitEntry.md index c0acd13..364b26a 100644 --- a/crates/gitea-client/docs/GitEntry.md +++ b/crates/gitea-client/docs/GitEntry.md @@ -4,12 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**mode** | Option<**String**> | | [optional] -**path** | Option<**String**> | | [optional] -**sha** | Option<**String**> | | [optional] -**size** | Option<**i64**> | | [optional] -**r#type** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**mode** | Option<**String**> | Mode is the file mode (permissions) | [optional] +**path** | Option<**String**> | Path is the file or directory path | [optional] +**sha** | Option<**String**> | SHA is the Git object SHA | [optional] +**size** | Option<**i64**> | Size is the file size in bytes | [optional] +**r#type** | Option<**String**> | Type indicates if this is a file, directory, or symlink | [optional] +**url** | Option<**String**> | URL is the API URL for this tree entry | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/GitHook.md b/crates/gitea-client/docs/GitHook.md index 9d52a95..3133d81 100644 --- a/crates/gitea-client/docs/GitHook.md +++ b/crates/gitea-client/docs/GitHook.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**content** | Option<**String**> | | [optional] -**is_active** | Option<**bool**> | | [optional] -**name** | Option<**String**> | | [optional] +**content** | Option<**String**> | Content contains the script content of the hook | [optional] +**is_active** | Option<**bool**> | IsActive indicates if the hook is active | [optional] +**name** | Option<**String**> | Name is the name of the Git hook | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/GitObject.md b/crates/gitea-client/docs/GitObject.md index 4ed7c79..5a067a5 100644 --- a/crates/gitea-client/docs/GitObject.md +++ b/crates/gitea-client/docs/GitObject.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**sha** | Option<**String**> | | [optional] -**r#type** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**sha** | Option<**String**> | The SHA hash of the Git object | [optional] +**r#type** | Option<**String**> | The type of the Git object (e.g., commit, tag, tree, blob) | [optional] +**url** | Option<**String**> | The URL to access this Git object | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/GitTreeResponse.md b/crates/gitea-client/docs/GitTreeResponse.md index 390705d..ab9f375 100644 --- a/crates/gitea-client/docs/GitTreeResponse.md +++ b/crates/gitea-client/docs/GitTreeResponse.md @@ -4,12 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**page** | Option<**i64**> | | [optional] -**sha** | Option<**String**> | | [optional] -**total_count** | Option<**i64**> | | [optional] -**tree** | Option<[**Vec**](GitEntry.md)> | | [optional] -**truncated** | Option<**bool**> | | [optional] -**url** | Option<**String**> | | [optional] +**page** | Option<**i64**> | Page is the current page number for pagination | [optional] +**sha** | Option<**String**> | SHA is the tree object SHA | [optional] +**total_count** | Option<**i64**> | TotalCount is the total number of entries in the tree | [optional] +**tree** | Option<[**Vec**](GitEntry.md)> | Entries contains the tree entries (files and directories) | [optional] +**truncated** | Option<**bool**> | Truncated indicates if the response was truncated due to size | [optional] +**url** | Option<**String**> | URL is the API URL for this tree | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/GitignoreTemplateInfo.md b/crates/gitea-client/docs/GitignoreTemplateInfo.md index 67edca5..621072d 100644 --- a/crates/gitea-client/docs/GitignoreTemplateInfo.md +++ b/crates/gitea-client/docs/GitignoreTemplateInfo.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | Option<**String**> | | [optional] -**source** | Option<**String**> | | [optional] +**name** | Option<**String**> | Name is the name of the gitignore template | [optional] +**source** | Option<**String**> | Source contains the content of the gitignore template | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/GpgKey.md b/crates/gitea-client/docs/GpgKey.md index 608c7b4..9232d8b 100644 --- a/crates/gitea-client/docs/GpgKey.md +++ b/crates/gitea-client/docs/GpgKey.md @@ -4,19 +4,19 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**can_certify** | Option<**bool**> | | [optional] -**can_encrypt_comms** | Option<**bool**> | | [optional] -**can_encrypt_storage** | Option<**bool**> | | [optional] -**can_sign** | Option<**bool**> | | [optional] +**can_certify** | Option<**bool**> | Whether the key can be used for certification | [optional] +**can_encrypt_comms** | Option<**bool**> | Whether the key can be used for encrypting communications | [optional] +**can_encrypt_storage** | Option<**bool**> | Whether the key can be used for encrypting storage | [optional] +**can_sign** | Option<**bool**> | Whether the key can be used for signing | [optional] **created_at** | Option<**String**> | | [optional] -**emails** | Option<[**Vec**](GPGKeyEmail.md)> | | [optional] +**emails** | Option<[**Vec**](GPGKeyEmail.md)> | List of email addresses associated with this GPG key | [optional] **expires_at** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**key_id** | Option<**String**> | | [optional] -**primary_key_id** | Option<**String**> | | [optional] -**public_key** | Option<**String**> | | [optional] -**subkeys** | Option<[**Vec**](GPGKey.md)> | | [optional] -**verified** | Option<**bool**> | | [optional] +**id** | Option<**i64**> | The unique identifier of the GPG key | [optional] +**key_id** | Option<**String**> | The key ID of the GPG key | [optional] +**primary_key_id** | Option<**String**> | The primary key ID of the GPG key | [optional] +**public_key** | Option<**String**> | The public key content in armored format | [optional] +**subkeys** | Option<[**Vec**](GPGKey.md)> | List of subkeys of this GPG key | [optional] +**verified** | Option<**bool**> | Whether the GPG key has been verified | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/GpgKeyEmail.md b/crates/gitea-client/docs/GpgKeyEmail.md index 191cd58..793421b 100644 --- a/crates/gitea-client/docs/GpgKeyEmail.md +++ b/crates/gitea-client/docs/GpgKeyEmail.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | Option<**String**> | | [optional] -**verified** | Option<**bool**> | | [optional] +**email** | Option<**String**> | The email address associated with the GPG key | [optional] +**verified** | Option<**bool**> | Whether the email address has been verified | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Hook.md b/crates/gitea-client/docs/Hook.md index 12e7e0c..83ec331 100644 --- a/crates/gitea-client/docs/Hook.md +++ b/crates/gitea-client/docs/Hook.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**active** | Option<**bool**> | | [optional] -**authorization_header** | Option<**String**> | | [optional] -**branch_filter** | Option<**String**> | | [optional] -**config** | Option<**std::collections::HashMap**> | | [optional] +**active** | Option<**bool**> | Whether the webhook is active and will be triggered | [optional] +**authorization_header** | Option<**String**> | Authorization header to include in webhook requests | [optional] +**branch_filter** | Option<**String**> | Branch filter pattern to determine which branches trigger the webhook | [optional] +**config** | Option<**std::collections::HashMap**> | Configuration settings for the webhook | [optional] **created_at** | Option<**String**> | | [optional] -**events** | Option<**Vec**> | | [optional] -**id** | Option<**i64**> | | [optional] -**r#type** | Option<**String**> | | [optional] +**events** | Option<**Vec**> | List of events that trigger this webhook | [optional] +**id** | Option<**i64**> | The unique identifier of the webhook | [optional] +**r#type** | Option<**String**> | The type of the webhook (e.g., gitea, slack, discord) | [optional] **updated_at** | Option<**String**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Identity.md b/crates/gitea-client/docs/Identity.md index 3f1e0a2..068e558 100644 --- a/crates/gitea-client/docs/Identity.md +++ b/crates/gitea-client/docs/Identity.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **email** | Option<**String**> | | [optional] -**name** | Option<**String**> | | [optional] +**name** | Option<**String**> | Name is the person's name | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Issue.md b/crates/gitea-client/docs/Issue.md index da68428..01b5122 100644 --- a/crates/gitea-client/docs/Issue.md +++ b/crates/gitea-client/docs/Issue.md @@ -25,6 +25,7 @@ Name | Type | Description | Notes **r#ref** | Option<**String**> | | [optional] **repository** | Option<[**models::RepositoryMeta**](RepositoryMeta.md)> | | [optional] **state** | Option<**String**> | StateType issue state type | [optional] +**time_estimate** | Option<**i64**> | | [optional] **title** | Option<**String**> | | [optional] **updated_at** | Option<**String**> | | [optional] **url** | Option<**String**> | | [optional] diff --git a/crates/gitea-client/docs/IssueApi.md b/crates/gitea-client/docs/IssueApi.md index 3a20e3a..d806fba 100644 --- a/crates/gitea-client/docs/IssueApi.md +++ b/crates/gitea-client/docs/IssueApi.md @@ -56,6 +56,7 @@ Method | HTTP request | Description [**issue_list_issue_dependencies**](IssueApi.md#issue_list_issue_dependencies) | **GET** /repos/{owner}/{repo}/issues/{index}/dependencies | List an issue's dependencies, i.e all issues that block this issue. [**issue_list_issues**](IssueApi.md#issue_list_issues) | **GET** /repos/{owner}/{repo}/issues | List a repository's issues [**issue_list_labels**](IssueApi.md#issue_list_labels) | **GET** /repos/{owner}/{repo}/labels | Get all of a repository's labels +[**issue_lock_issue**](IssueApi.md#issue_lock_issue) | **PUT** /repos/{owner}/{repo}/issues/{index}/lock | Lock an issue [**issue_post_comment_reaction**](IssueApi.md#issue_post_comment_reaction) | **POST** /repos/{owner}/{repo}/issues/comments/{id}/reactions | Add a reaction to a comment of an issue [**issue_post_issue_reaction**](IssueApi.md#issue_post_issue_reaction) | **POST** /repos/{owner}/{repo}/issues/{index}/reactions | Add a reaction to an issue [**issue_remove_issue_blocking**](IssueApi.md#issue_remove_issue_blocking) | **DELETE** /repos/{owner}/{repo}/issues/{index}/blocks | Unblock the issue given in the body by the issue in path @@ -68,6 +69,7 @@ Method | HTTP request | Description [**issue_stop_stop_watch**](IssueApi.md#issue_stop_stop_watch) | **POST** /repos/{owner}/{repo}/issues/{index}/stopwatch/stop | Stop an issue's existing stopwatch. [**issue_subscriptions**](IssueApi.md#issue_subscriptions) | **GET** /repos/{owner}/{repo}/issues/{index}/subscriptions | Get users who subscribed on an issue. [**issue_tracked_times**](IssueApi.md#issue_tracked_times) | **GET** /repos/{owner}/{repo}/issues/{index}/times | List an issue's tracked times +[**issue_unlock_issue**](IssueApi.md#issue_unlock_issue) | **DELETE** /repos/{owner}/{repo}/issues/{index}/lock | Unlock an issue [**move_issue_pin**](IssueApi.md#move_issue_pin) | **PATCH** /repos/{owner}/{repo}/issues/{index}/pin/{position} | Moves the Pin to the given Position [**pin_issue**](IssueApi.md#pin_issue) | **POST** /repos/{owner}/{repo}/issues/{index}/pin | Pin an Issue [**unpin_issue**](IssueApi.md#unpin_issue) | **DELETE** /repos/{owner}/{repo}/issues/{index}/pin | Unpin an Issue @@ -118,7 +120,7 @@ Name | Type | Description | Required | Notes **owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repo | [required] | **index** | **i64** | index of the issue | [required] | -**user** | **String** | user to subscribe | [required] | +**user** | **String** | username of the user to subscribe the issue to | [required] | ### Return type @@ -792,7 +794,7 @@ Name | Type | Description | Required | Notes **owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repo | [required] | **index** | **i64** | index of the issue | [required] | -**user** | **String** | user witch unsubscribe | [required] | +**user** | **String** | username of the user to unsubscribe from an issue | [required] | ### Return type @@ -1694,6 +1696,37 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## issue_lock_issue + +> issue_lock_issue(owner, repo, index, body) +Lock an issue + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**index** | **i64** | index of the issue | [required] | +**body** | Option<[**LockIssueOption**](LockIssueOption.md)> | | | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## issue_post_comment_reaction > models::Reaction issue_post_comment_reaction(owner, repo, id, content) @@ -1920,23 +1953,23 @@ Search for issues across the repositories that the user has access to Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**state** | Option<**String**> | whether issue is open or closed | | -**labels** | Option<**String**> | comma separated list of labels. Fetch only issues that have any of this labels. Non existent labels are discarded | | -**milestones** | Option<**String**> | comma separated list of milestone names. Fetch only issues that have any of this milestones. Non existent are discarded | | -**q** | Option<**String**> | search string | | -**priority_repo_id** | Option<**i64**> | repository to prioritize in the results | | -**r#type** | Option<**String**> | filter by type (issues / pulls) if set | | -**since** | Option<**String**> | Only show notifications updated after the given time. This is a timestamp in RFC 3339 format | | -**before** | Option<**String**> | Only show notifications updated before the given time. This is a timestamp in RFC 3339 format | | -**assigned** | Option<**bool**> | filter (issues / pulls) assigned to you, default is false | | -**created** | Option<**bool**> | filter (issues / pulls) created by you, default is false | | -**mentioned** | Option<**bool**> | filter (issues / pulls) mentioning you, default is false | | -**review_requested** | Option<**bool**> | filter pulls requesting your review, default is false | | -**reviewed** | Option<**bool**> | filter pulls reviewed by you, default is false | | -**owner** | Option<**String**> | filter by owner | | -**team** | Option<**String**> | filter by team (requires organization owner parameter to be provided) | | -**page** | Option<**i32**> | page number of results to return (1-based) | | -**limit** | Option<**i32**> | page size of results | | +**state** | Option<**String**> | State of the issue | |[default to open] +**labels** | Option<**String**> | Comma-separated list of label names. Fetch only issues that have any of these labels. Non existent labels are discarded. | | +**milestones** | Option<**String**> | Comma-separated list of milestone names. Fetch only issues that have any of these milestones. Non existent milestones are discarded. | | +**q** | Option<**String**> | Search string | | +**priority_repo_id** | Option<**i64**> | Repository ID to prioritize in the results | | +**r#type** | Option<**String**> | Filter by issue type | | +**since** | Option<**String**> | Only show issues updated after the given time (RFC 3339 format) | | +**before** | Option<**String**> | Only show issues updated before the given time (RFC 3339 format) | | +**assigned** | Option<**bool**> | Filter issues or pulls assigned to the authenticated user | |[default to false] +**created** | Option<**bool**> | Filter issues or pulls created by the authenticated user | |[default to false] +**mentioned** | Option<**bool**> | Filter issues or pulls mentioning the authenticated user | |[default to false] +**review_requested** | Option<**bool**> | Filter pull requests where the authenticated user's review was requested | |[default to false] +**reviewed** | Option<**bool**> | Filter pull requests reviewed by the authenticated user | |[default to false] +**owner** | Option<**String**> | Filter by repository owner | | +**team** | Option<**String**> | Filter by team (requires organization owner parameter) | | +**page** | Option<**i32**> | Page number of results to return (1-based) | |[default to 1] +**limit** | Option<**i32**> | Number of items per page | | ### Return type @@ -2081,6 +2114,36 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## issue_unlock_issue + +> issue_unlock_issue(owner, repo, index) +Unlock an issue + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**index** | **i64** | index of the issue | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## move_issue_pin > move_issue_pin(owner, repo, index, position) diff --git a/crates/gitea-client/docs/IssueFormField.md b/crates/gitea-client/docs/IssueFormField.md index 975aacb..14da9ac 100644 --- a/crates/gitea-client/docs/IssueFormField.md +++ b/crates/gitea-client/docs/IssueFormField.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**attributes** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | | [optional] +**attributes** | Option<**std::collections::HashMap**> | | [optional] **id** | Option<**String**> | | [optional] **r#type** | Option<**String**> | | [optional] -**validations** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | | [optional] +**validations** | Option<**std::collections::HashMap**> | | [optional] **visible** | Option<**Vec**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/IssueLabelsOption.md b/crates/gitea-client/docs/IssueLabelsOption.md index 32a84a6..d91381d 100644 --- a/crates/gitea-client/docs/IssueLabelsOption.md +++ b/crates/gitea-client/docs/IssueLabelsOption.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**labels** | Option<[**Vec**](serde_json::Value.md)> | Labels can be a list of integers representing label IDs or a list of strings representing label names | [optional] +**labels** | Option<**Vec**> | Labels can be a list of integers representing label IDs or a list of strings representing label names | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/IssueMeta.md b/crates/gitea-client/docs/IssueMeta.md index a5000bc..650264d 100644 --- a/crates/gitea-client/docs/IssueMeta.md +++ b/crates/gitea-client/docs/IssueMeta.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **index** | Option<**i64**> | | [optional] -**owner** | Option<**String**> | | [optional] +**owner** | Option<**String**> | owner of the issue's repo | [optional] **repo** | Option<**String**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/IssueTemplate.md b/crates/gitea-client/docs/IssueTemplate.md index 34679d6..356d379 100644 --- a/crates/gitea-client/docs/IssueTemplate.md +++ b/crates/gitea-client/docs/IssueTemplate.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **about** | Option<**String**> | | [optional] +**assignees** | Option<**Vec**> | | [optional] **body** | Option<[**Vec**](IssueFormField.md)> | | [optional] **content** | Option<**String**> | | [optional] **file_name** | Option<**String**> | | [optional] diff --git a/crates/gitea-client/docs/Label.md b/crates/gitea-client/docs/Label.md index a018dbb..7f17a3b 100644 --- a/crates/gitea-client/docs/Label.md +++ b/crates/gitea-client/docs/Label.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **color** | Option<**String**> | | [optional] -**description** | Option<**String**> | | [optional] +**description** | Option<**String**> | Description provides additional context about the label's purpose | [optional] **exclusive** | Option<**bool**> | | [optional] -**id** | Option<**i64**> | | [optional] +**id** | Option<**i64**> | ID is the unique identifier for the label | [optional] **is_archived** | Option<**bool**> | | [optional] -**name** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**name** | Option<**String**> | Name is the display name of the label | [optional] +**url** | Option<**String**> | URL is the API endpoint for accessing this label | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/LabelTemplate.md b/crates/gitea-client/docs/LabelTemplate.md index d0ded8d..7551f6d 100644 --- a/crates/gitea-client/docs/LabelTemplate.md +++ b/crates/gitea-client/docs/LabelTemplate.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **color** | Option<**String**> | | [optional] -**description** | Option<**String**> | | [optional] +**description** | Option<**String**> | Description provides additional context about the label template's purpose | [optional] **exclusive** | Option<**bool**> | | [optional] -**name** | Option<**String**> | | [optional] +**name** | Option<**String**> | Name is the display name of the label template | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/LicenseTemplateInfo.md b/crates/gitea-client/docs/LicenseTemplateInfo.md index 832dc8c..b664c9e 100644 --- a/crates/gitea-client/docs/LicenseTemplateInfo.md +++ b/crates/gitea-client/docs/LicenseTemplateInfo.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**body** | Option<**String**> | | [optional] -**implementation** | Option<**String**> | | [optional] -**key** | Option<**String**> | | [optional] -**name** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**body** | Option<**String**> | Body contains the full text of the license | [optional] +**implementation** | Option<**String**> | Implementation contains license implementation details | [optional] +**key** | Option<**String**> | Key is the unique identifier for the license template | [optional] +**name** | Option<**String**> | Name is the display name of the license | [optional] +**url** | Option<**String**> | URL is the reference URL for the license | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/LicensesTemplateListEntry.md b/crates/gitea-client/docs/LicensesTemplateListEntry.md index 0a1a61a..7efc5e0 100644 --- a/crates/gitea-client/docs/LicensesTemplateListEntry.md +++ b/crates/gitea-client/docs/LicensesTemplateListEntry.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**key** | Option<**String**> | | [optional] -**name** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**key** | Option<**String**> | Key is the unique identifier for the license template | [optional] +**name** | Option<**String**> | Name is the display name of the license | [optional] +**url** | Option<**String**> | URL is the reference URL for the license | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/LockIssueOption.md b/crates/gitea-client/docs/LockIssueOption.md new file mode 100644 index 0000000..e1b5bd8 --- /dev/null +++ b/crates/gitea-client/docs/LockIssueOption.md @@ -0,0 +1,11 @@ +# LockIssueOption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**lock_reason** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/MarkdownOption.md b/crates/gitea-client/docs/MarkdownOption.md index d017b12..be34d49 100644 --- a/crates/gitea-client/docs/MarkdownOption.md +++ b/crates/gitea-client/docs/MarkdownOption.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **context** | Option<**String**> | URL path for rendering issue, media and file links Expected format: /subpath/{user}/{repo}/src/{branch, commit, tag}/{identifier/path}/{file/dir} in: body | [optional] -**mode** | Option<**String**> | Mode to render (comment, gfm, markdown) in: body | [optional] +**mode** | Option<**String**> | Mode to render (markdown, comment, wiki, file) in: body | [optional] **text** | Option<**String**> | Text markdown to render in: body | [optional] -**wiki** | Option<**bool**> | Is it a wiki page ? in: body | [optional] +**wiki** | Option<**bool**> | Is it a wiki page? (use mode=wiki instead) Deprecated: true in: body | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/MarkupOption.md b/crates/gitea-client/docs/MarkupOption.md index ecde875..a5e3457 100644 --- a/crates/gitea-client/docs/MarkupOption.md +++ b/crates/gitea-client/docs/MarkupOption.md @@ -6,9 +6,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **context** | Option<**String**> | URL path for rendering issue, media and file links Expected format: /subpath/{user}/{repo}/src/{branch, commit, tag}/{identifier/path}/{file/dir} in: body | [optional] **file_path** | Option<**String**> | File path for detecting extension in file mode in: body | [optional] -**mode** | Option<**String**> | Mode to render (comment, gfm, markdown, file) in: body | [optional] +**mode** | Option<**String**> | Mode to render (markdown, comment, wiki, file) in: body | [optional] **text** | Option<**String**> | Text markup to render in: body | [optional] -**wiki** | Option<**bool**> | Is it a wiki page ? in: body | [optional] +**wiki** | Option<**bool**> | Is it a wiki page? (use mode=wiki instead) Deprecated: true in: body | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/MergePullRequestOption.md b/crates/gitea-client/docs/MergePullRequestOption.md index 8f88bcc..1755f6b 100644 --- a/crates/gitea-client/docs/MergePullRequestOption.md +++ b/crates/gitea-client/docs/MergePullRequestOption.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**r#do** | **String** | | +**r#do** | **Do** | (enum: merge, rebase, rebase-merge, squash, fast-forward-only, manually-merged) | **merge_commit_id** | Option<**String**> | | [optional] **merge_message_field** | Option<**String**> | | [optional] **merge_title_field** | Option<**String**> | | [optional] diff --git a/crates/gitea-client/docs/MergeUpstreamRequest.md b/crates/gitea-client/docs/MergeUpstreamRequest.md new file mode 100644 index 0000000..e1e9a90 --- /dev/null +++ b/crates/gitea-client/docs/MergeUpstreamRequest.md @@ -0,0 +1,12 @@ +# MergeUpstreamRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**branch** | Option<**String**> | | [optional] +**ff_only** | Option<**bool**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/MergeUpstreamResponse.md b/crates/gitea-client/docs/MergeUpstreamResponse.md new file mode 100644 index 0000000..fb74625 --- /dev/null +++ b/crates/gitea-client/docs/MergeUpstreamResponse.md @@ -0,0 +1,11 @@ +# MergeUpstreamResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**merge_type** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/MigrateRepoOptions.md b/crates/gitea-client/docs/MigrateRepoOptions.md index c5ede9c..d8ef19b 100644 --- a/crates/gitea-client/docs/MigrateRepoOptions.md +++ b/crates/gitea-client/docs/MigrateRepoOptions.md @@ -7,6 +7,8 @@ Name | Type | Description | Notes **auth_password** | Option<**String**> | | [optional] **auth_token** | Option<**String**> | | [optional] **auth_username** | Option<**String**> | | [optional] +**aws_access_key_id** | Option<**String**> | | [optional] +**aws_secret_access_key** | Option<**String**> | | [optional] **clone_addr** | **String** | | **description** | Option<**String**> | | [optional] **issues** | Option<**bool**> | | [optional] @@ -20,9 +22,9 @@ Name | Type | Description | Notes **pull_requests** | Option<**bool**> | | [optional] **releases** | Option<**bool**> | | [optional] **repo_name** | **String** | | -**repo_owner** | Option<**String**> | Name of User or Organisation who will own Repo after migration | [optional] -**service** | Option<**String**> | | [optional] -**uid** | Option<**i64**> | deprecated (only for backwards compatibility) | [optional] +**repo_owner** | Option<**String**> | the organization's name or individual user's name who will own the migrated repository | [optional] +**service** | Option<**Service**> | (enum: git, github, gitea, gitlab, gogs, onedev, gitbucket, codebase, codecommit) | [optional] +**uid** | Option<**i64**> | deprecated (only for backwards compatibility, use repo_owner instead) | [optional] **wiki** | Option<**bool**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Milestone.md b/crates/gitea-client/docs/Milestone.md index c92f404..5de81ea 100644 --- a/crates/gitea-client/docs/Milestone.md +++ b/crates/gitea-client/docs/Milestone.md @@ -5,14 +5,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **closed_at** | Option<**String**> | | [optional] -**closed_issues** | Option<**i64**> | | [optional] +**closed_issues** | Option<**i64**> | ClosedIssues is the number of closed issues in this milestone | [optional] **created_at** | Option<**String**> | | [optional] -**description** | Option<**String**> | | [optional] +**description** | Option<**String**> | Description provides details about the milestone | [optional] **due_on** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**open_issues** | Option<**i64**> | | [optional] +**id** | Option<**i64**> | ID is the unique identifier for the milestone | [optional] +**open_issues** | Option<**i64**> | OpenIssues is the number of open issues in this milestone | [optional] **state** | Option<**String**> | StateType issue state type | [optional] -**title** | Option<**String**> | | [optional] +**title** | Option<**String**> | Title is the title of the milestone | [optional] **updated_at** | Option<**String**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/MiscellaneousApi.md b/crates/gitea-client/docs/MiscellaneousApi.md index 9e6cf9b..be0a856 100644 --- a/crates/gitea-client/docs/MiscellaneousApi.md +++ b/crates/gitea-client/docs/MiscellaneousApi.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**get_license_template_info**](MiscellaneousApi.md#get_license_template_info) | **GET** /licenses/{name} | Returns information about a license template [**get_node_info**](MiscellaneousApi.md#get_node_info) | **GET** /nodeinfo | Returns the nodeinfo of the Gitea application [**get_signing_key**](MiscellaneousApi.md#get_signing_key) | **GET** /signing-key.gpg | Get default signing-key.gpg +[**get_signing_key_ssh**](MiscellaneousApi.md#get_signing_key_ssh) | **GET** /signing-key.pub | Get default signing-key.pub [**get_version**](MiscellaneousApi.md#get_version) | **GET** /version | Returns the version of the Gitea application [**list_gitignores_templates**](MiscellaneousApi.md#list_gitignores_templates) | **GET** /gitignore/templates | Returns a list of all gitignore templates [**list_label_templates**](MiscellaneousApi.md#list_label_templates) | **GET** /label/templates | Returns a list of all label templates @@ -153,6 +154,31 @@ This endpoint does not need any parameter. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## get_signing_key_ssh + +> String get_signing_key_ssh() +Get default signing-key.pub + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**String** + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## get_version > models::ServerVersion get_version() diff --git a/crates/gitea-client/docs/NodeInfo.md b/crates/gitea-client/docs/NodeInfo.md index 42b7ae9..ccdafd8 100644 --- a/crates/gitea-client/docs/NodeInfo.md +++ b/crates/gitea-client/docs/NodeInfo.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**metadata** | Option<[**serde_json::Value**](.md)> | | [optional] -**open_registrations** | Option<**bool**> | | [optional] -**protocols** | Option<**Vec**> | | [optional] +**metadata** | Option<**serde_json::Value**> | Metadata contains free form key value pairs for software specific values | [optional] +**open_registrations** | Option<**bool**> | OpenRegistrations indicates if new user registrations are accepted | [optional] +**protocols** | Option<**Vec**> | Protocols lists the protocols supported by this server | [optional] **services** | Option<[**models::NodeInfoServices**](NodeInfoServices.md)> | | [optional] **software** | Option<[**models::NodeInfoSoftware**](NodeInfoSoftware.md)> | | [optional] **usage** | Option<[**models::NodeInfoUsage**](NodeInfoUsage.md)> | | [optional] -**version** | Option<**String**> | | [optional] +**version** | Option<**String**> | Version specifies the schema version | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/NodeInfoServices.md b/crates/gitea-client/docs/NodeInfoServices.md index 1cde335..517f8f2 100644 --- a/crates/gitea-client/docs/NodeInfoServices.md +++ b/crates/gitea-client/docs/NodeInfoServices.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**inbound** | Option<**Vec**> | | [optional] -**outbound** | Option<**Vec**> | | [optional] +**inbound** | Option<**Vec**> | Inbound lists services that can deliver content to this server | [optional] +**outbound** | Option<**Vec**> | Outbound lists services this server can deliver content to | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/NodeInfoSoftware.md b/crates/gitea-client/docs/NodeInfoSoftware.md index 0660bf8..2c237fe 100644 --- a/crates/gitea-client/docs/NodeInfoSoftware.md +++ b/crates/gitea-client/docs/NodeInfoSoftware.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**homepage** | Option<**String**> | | [optional] -**name** | Option<**String**> | | [optional] -**repository** | Option<**String**> | | [optional] -**version** | Option<**String**> | | [optional] +**homepage** | Option<**String**> | Homepage is the URL to the homepage of this server software | [optional] +**name** | Option<**String**> | Name is the canonical name of this server software | [optional] +**repository** | Option<**String**> | Repository is the URL to the source code repository | [optional] +**version** | Option<**String**> | Version is the version of this server software | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/NodeInfoUsage.md b/crates/gitea-client/docs/NodeInfoUsage.md index a4246f7..522908e 100644 --- a/crates/gitea-client/docs/NodeInfoUsage.md +++ b/crates/gitea-client/docs/NodeInfoUsage.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**local_comments** | Option<**i64**> | | [optional] -**local_posts** | Option<**i64**> | | [optional] +**local_comments** | Option<**i64**> | LocalComments is the total amount of comments made by users local to this server | [optional] +**local_posts** | Option<**i64**> | LocalPosts is the total amount of posts made by users local to this server | [optional] **users** | Option<[**models::NodeInfoUsageUsers**](NodeInfoUsageUsers.md)> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/NodeInfoUsageUsers.md b/crates/gitea-client/docs/NodeInfoUsageUsers.md index ee1808b..3f07bcc 100644 --- a/crates/gitea-client/docs/NodeInfoUsageUsers.md +++ b/crates/gitea-client/docs/NodeInfoUsageUsers.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**active_halfyear** | Option<**i64**> | | [optional] -**active_month** | Option<**i64**> | | [optional] -**total** | Option<**i64**> | | [optional] +**active_halfyear** | Option<**i64**> | ActiveHalfyear is the amount of users that signed in at least once in the last 180 days | [optional] +**active_month** | Option<**i64**> | ActiveMonth is the amount of users that signed in at least once in the last 30 days | [optional] +**total** | Option<**i64**> | Total is the total amount of users on this server | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Note.md b/crates/gitea-client/docs/Note.md index f32f313..a28e426 100644 --- a/crates/gitea-client/docs/Note.md +++ b/crates/gitea-client/docs/Note.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **commit** | Option<[**models::Commit**](Commit.md)> | | [optional] -**message** | Option<**String**> | | [optional] +**message** | Option<**String**> | The content message of the git note | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/NotificationCount.md b/crates/gitea-client/docs/NotificationCount.md index 0c76de0..8cea046 100644 --- a/crates/gitea-client/docs/NotificationCount.md +++ b/crates/gitea-client/docs/NotificationCount.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**new** | Option<**i64**> | | [optional] +**new** | Option<**i64**> | New is the number of unread notifications | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/NotificationSubject.md b/crates/gitea-client/docs/NotificationSubject.md index 8a28c83..3334863 100644 --- a/crates/gitea-client/docs/NotificationSubject.md +++ b/crates/gitea-client/docs/NotificationSubject.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**html_url** | Option<**String**> | | [optional] -**latest_comment_html_url** | Option<**String**> | | [optional] -**latest_comment_url** | Option<**String**> | | [optional] +**html_url** | Option<**String**> | HTMLURL is the web URL for the notification subject | [optional] +**latest_comment_html_url** | Option<**String**> | LatestCommentHTMLURL is the web URL for the latest comment | [optional] +**latest_comment_url** | Option<**String**> | LatestCommentURL is the API URL for the latest comment | [optional] **state** | Option<**String**> | StateType issue state type | [optional] -**title** | Option<**String**> | | [optional] +**title** | Option<**String**> | Title is the title of the notification subject | [optional] **r#type** | Option<**String**> | NotifySubjectType represent type of notification subject | [optional] -**url** | Option<**String**> | | [optional] +**url** | Option<**String**> | URL is the API URL for the notification subject | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/NotificationThread.md b/crates/gitea-client/docs/NotificationThread.md index a67580f..e2b02e7 100644 --- a/crates/gitea-client/docs/NotificationThread.md +++ b/crates/gitea-client/docs/NotificationThread.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | Option<**i64**> | | [optional] -**pinned** | Option<**bool**> | | [optional] +**id** | Option<**i64**> | ID is the unique identifier for the notification thread | [optional] +**pinned** | Option<**bool**> | Pinned indicates if the notification is pinned | [optional] **repository** | Option<[**models::Repository**](Repository.md)> | | [optional] **subject** | Option<[**models::NotificationSubject**](NotificationSubject.md)> | | [optional] -**unread** | Option<**bool**> | | [optional] -**updated_at** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**unread** | Option<**bool**> | Unread indicates if the notification has been read | [optional] +**updated_at** | Option<**String**> | UpdatedAt is the time when the notification was last updated | [optional] +**url** | Option<**String**> | URL is the API URL for this notification thread | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/OAuth2Application.md b/crates/gitea-client/docs/OAuth2Application.md index 19e3cbb..4eeb4bf 100644 --- a/crates/gitea-client/docs/OAuth2Application.md +++ b/crates/gitea-client/docs/OAuth2Application.md @@ -4,13 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**client_id** | Option<**String**> | | [optional] -**client_secret** | Option<**String**> | | [optional] -**confidential_client** | Option<**bool**> | | [optional] -**created** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**name** | Option<**String**> | | [optional] -**redirect_uris** | Option<**Vec**> | | [optional] +**client_id** | Option<**String**> | The client ID of the OAuth2 application | [optional] +**client_secret** | Option<**String**> | The client secret of the OAuth2 application | [optional] +**confidential_client** | Option<**bool**> | Whether the client is confidential | [optional] +**created** | Option<**String**> | The timestamp when the application was created | [optional] +**id** | Option<**i64**> | The unique identifier of the OAuth2 application | [optional] +**name** | Option<**String**> | The name of the OAuth2 application | [optional] +**redirect_uris** | Option<**Vec**> | The list of allowed redirect URIs | [optional] +**skip_secondary_authorization** | Option<**bool**> | Whether to skip secondary authorization | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Organization.md b/crates/gitea-client/docs/Organization.md index 5ca228b..0f8fb4b 100644 --- a/crates/gitea-client/docs/Organization.md +++ b/crates/gitea-client/docs/Organization.md @@ -4,17 +4,17 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**avatar_url** | Option<**String**> | | [optional] -**description** | Option<**String**> | | [optional] -**email** | Option<**String**> | | [optional] -**full_name** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**location** | Option<**String**> | | [optional] -**name** | Option<**String**> | | [optional] -**repo_admin_change_team_access** | Option<**bool**> | | [optional] -**username** | Option<**String**> | deprecated | [optional] -**visibility** | Option<**String**> | | [optional] -**website** | Option<**String**> | | [optional] +**avatar_url** | Option<**String**> | The URL of the organization's avatar | [optional] +**description** | Option<**String**> | The description of the organization | [optional] +**email** | Option<**String**> | The email address of the organization | [optional] +**full_name** | Option<**String**> | The full display name of the organization | [optional] +**id** | Option<**i64**> | The unique identifier of the organization | [optional] +**location** | Option<**String**> | The location of the organization | [optional] +**name** | Option<**String**> | The name of the organization | [optional] +**repo_admin_change_team_access** | Option<**bool**> | Whether repository administrators can change team access | [optional] +**username** | Option<**String**> | username of the organization deprecated | [optional] +**visibility** | Option<**String**> | The visibility level of the organization (public, limited, private) | [optional] +**website** | Option<**String**> | The website URL of the organization | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/OrganizationApi.md b/crates/gitea-client/docs/OrganizationApi.md index d86e6c6..83b9854 100644 --- a/crates/gitea-client/docs/OrganizationApi.md +++ b/crates/gitea-client/docs/OrganizationApi.md @@ -7,16 +7,22 @@ Method | HTTP request | Description [**create_org_repo**](OrganizationApi.md#create_org_repo) | **POST** /orgs/{org}/repos | Create a repository in an organization [**create_org_repo_deprecated**](OrganizationApi.md#create_org_repo_deprecated) | **POST** /org/{org}/repos | Create a repository in an organization [**create_org_variable**](OrganizationApi.md#create_org_variable) | **POST** /orgs/{org}/actions/variables/{variablename} | Create an org-level variable +[**delete_org_runner**](OrganizationApi.md#delete_org_runner) | **DELETE** /orgs/{org}/actions/runners/{runner_id} | Delete an org-level runner [**delete_org_secret**](OrganizationApi.md#delete_org_secret) | **DELETE** /orgs/{org}/actions/secrets/{secretname} | Delete a secret in an organization [**delete_org_variable**](OrganizationApi.md#delete_org_variable) | **DELETE** /orgs/{org}/actions/variables/{variablename} | Delete an org-level variable +[**get_org_runner**](OrganizationApi.md#get_org_runner) | **GET** /orgs/{org}/actions/runners/{runner_id} | Get an org-level runner +[**get_org_runners**](OrganizationApi.md#get_org_runners) | **GET** /orgs/{org}/actions/runners | Get org-level runners [**get_org_variable**](OrganizationApi.md#get_org_variable) | **GET** /orgs/{org}/actions/variables/{variablename} | Get an org-level variable [**get_org_variables_list**](OrganizationApi.md#get_org_variables_list) | **GET** /orgs/{org}/actions/variables | Get an org-level variables list +[**get_org_workflow_jobs**](OrganizationApi.md#get_org_workflow_jobs) | **GET** /orgs/{org}/actions/jobs | Get org-level workflow jobs +[**get_org_workflow_runs**](OrganizationApi.md#get_org_workflow_runs) | **GET** /orgs/{org}/actions/runs | Get org-level workflow runs [**org_add_team_member**](OrganizationApi.md#org_add_team_member) | **PUT** /teams/{id}/members/{username} | Add a team member [**org_add_team_repository**](OrganizationApi.md#org_add_team_repository) | **PUT** /teams/{id}/repos/{org}/{repo} | Add a repository to a team [**org_conceal_member**](OrganizationApi.md#org_conceal_member) | **DELETE** /orgs/{org}/public_members/{username} | Conceal a user's membership [**org_create**](OrganizationApi.md#org_create) | **POST** /orgs | Create an organization [**org_create_hook**](OrganizationApi.md#org_create_hook) | **POST** /orgs/{org}/hooks | Create a hook [**org_create_label**](OrganizationApi.md#org_create_label) | **POST** /orgs/{org}/labels | Create a label for an organization +[**org_create_runner_registration_token**](OrganizationApi.md#org_create_runner_registration_token) | **POST** /orgs/{org}/actions/runners/registration-token | Get an organization's actions runner registration token [**org_create_team**](OrganizationApi.md#org_create_team) | **POST** /orgs/{org}/teams | Create a team [**org_delete**](OrganizationApi.md#org_delete) | **DELETE** /orgs/{org} | Delete an organization [**org_delete_avatar**](OrganizationApi.md#org_delete_avatar) | **DELETE** /orgs/{org}/avatar | Delete Avatar @@ -60,6 +66,7 @@ Method | HTTP request | Description [**organization_check_user_block**](OrganizationApi.md#organization_check_user_block) | **GET** /orgs/{org}/blocks/{username} | Check if a user is blocked by the organization [**organization_list_blocks**](OrganizationApi.md#organization_list_blocks) | **GET** /orgs/{org}/blocks | List users blocked by the organization [**organization_unblock_user**](OrganizationApi.md#organization_unblock_user) | **DELETE** /orgs/{org}/blocks/{username} | Unblock a user +[**rename_org**](OrganizationApi.md#rename_org) | **POST** /orgs/{org}/rename | Rename an organization [**team_search**](OrganizationApi.md#team_search) | **GET** /orgs/{org}/teams/search | Search for teams within an organization [**update_org_secret**](OrganizationApi.md#update_org_secret) | **PUT** /orgs/{org}/actions/secrets/{secretname} | Create or Update a secret value in an organization [**update_org_variable**](OrganizationApi.md#update_org_variable) | **PUT** /orgs/{org}/actions/variables/{variablename} | Update an org-level variable @@ -154,6 +161,35 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## delete_org_runner + +> delete_org_runner(org, runner_id) +Delete an org-level runner + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**org** | **String** | name of the organization | [required] | +**runner_id** | **String** | id of the runner | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## delete_org_secret > delete_org_secret(org, secretname) @@ -212,6 +248,63 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## get_org_runner + +> get_org_runner(org, runner_id) +Get an org-level runner + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**org** | **String** | name of the organization | [required] | +**runner_id** | **String** | id of the runner | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## get_org_runners + +> get_org_runners(org) +Get org-level runners + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**org** | **String** | name of the organization | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## get_org_variable > models::ActionVariable get_org_variable(org, variablename) @@ -271,6 +364,72 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## get_org_workflow_jobs + +> models::ActionWorkflowJobsResponse get_org_workflow_jobs(org, status, page, limit) +Get org-level workflow jobs + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**org** | **String** | name of the organization | [required] | +**status** | Option<**String**> | workflow status (pending, queued, in_progress, failure, success, skipped) | | +**page** | Option<**i32**> | page number of results to return (1-based) | | +**limit** | Option<**i32**> | page size of results | | + +### Return type + +[**models::ActionWorkflowJobsResponse**](ActionWorkflowJobsResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## get_org_workflow_runs + +> models::ActionWorkflowRunsResponse get_org_workflow_runs(org, event, branch, status, actor, head_sha, page, limit) +Get org-level workflow runs + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**org** | **String** | name of the organization | [required] | +**event** | Option<**String**> | workflow event name | | +**branch** | Option<**String**> | workflow branch | | +**status** | Option<**String**> | workflow status (pending, queued, in_progress, failure, success, skipped) | | +**actor** | Option<**String**> | triggered by user | | +**head_sha** | Option<**String**> | triggering sha of the workflow run | | +**page** | Option<**i32**> | page number of results to return (1-based) | | +**limit** | Option<**i32**> | page size of results | | + +### Return type + +[**models::ActionWorkflowRunsResponse**](ActionWorkflowRunsResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## org_add_team_member > org_add_team_member(id, username) @@ -282,7 +441,7 @@ Add a team member Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **id** | **i64** | id of the team | [required] | -**username** | **String** | username of the user to add | [required] | +**username** | **String** | username of the user to add to a team | [required] | ### Return type @@ -341,7 +500,7 @@ Conceal a user's membership Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **org** | **String** | name of the organization | [required] | -**username** | **String** | username of the user | [required] | +**username** | **String** | username of the user whose membership is to be concealed | [required] | ### Return type @@ -445,6 +604,34 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## org_create_runner_registration_token + +> org_create_runner_registration_token(org) +Get an organization's actions runner registration token + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**org** | **String** | name of the organization | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## org_create_team > models::Team org_create_team(org, body) @@ -599,7 +786,7 @@ Remove a member from an organization Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **org** | **String** | name of the organization | [required] | -**username** | **String** | username of the user | [required] | +**username** | **String** | username of the user to remove from the organization | [required] | ### Return type @@ -944,7 +1131,7 @@ Get user permissions in organization Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose permissions are to be obtained | [required] | **org** | **String** | name of the organization | [required] | ### Return type @@ -974,7 +1161,7 @@ Check if a user is a member of an organization Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **org** | **String** | name of the organization | [required] | -**username** | **String** | username of the user | [required] | +**username** | **String** | username of the user to check for an organization membership | [required] | ### Return type @@ -1003,7 +1190,7 @@ Check if a user is a public member of an organization Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **org** | **String** | name of the organization | [required] | -**username** | **String** | username of the user | [required] | +**username** | **String** | username of the user to check for a public organization membership | [required] | ### Return type @@ -1303,7 +1490,7 @@ List a particular member of team Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **id** | **i64** | id of the team | [required] | -**username** | **String** | username of the member to list | [required] | +**username** | **String** | username of the user whose data is to be listed | [required] | ### Return type @@ -1451,7 +1638,7 @@ List a user's organizations Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose organizations are to be listed | [required] | **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | @@ -1482,7 +1669,7 @@ Publicize a user's membership Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **org** | **String** | name of the organization | [required] | -**username** | **String** | username of the user | [required] | +**username** | **String** | username of the user whose membership is to be publicized | [required] | ### Return type @@ -1511,7 +1698,7 @@ Remove a team member Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **id** | **i64** | id of the team | [required] | -**username** | **String** | username of the user to remove | [required] | +**username** | **String** | username of the user to remove from a team | [required] | ### Return type @@ -1601,7 +1788,7 @@ Block a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **org** | **String** | name of the organization | [required] | -**username** | **String** | user to block | [required] | +**username** | **String** | username of the user to block | [required] | **note** | Option<**String**> | optional note for the block | | ### Return type @@ -1631,7 +1818,7 @@ Check if a user is blocked by the organization Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **org** | **String** | name of the organization | [required] | -**username** | **String** | user to check | [required] | +**username** | **String** | username of the user to check | [required] | ### Return type @@ -1690,7 +1877,7 @@ Unblock a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **org** | **String** | name of the organization | [required] | -**username** | **String** | user to unblock | [required] | +**username** | **String** | username of the user to unblock | [required] | ### Return type @@ -1708,6 +1895,35 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## rename_org + +> rename_org(org, body) +Rename an organization + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**org** | **String** | existing org name | [required] | +**body** | [**RenameOrgOption**](RenameOrgOption.md) | | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json, text/plain +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## team_search > models::TeamSearch200Response team_search(org, q, include_desc, page, limit) diff --git a/crates/gitea-client/docs/OrganizationPermissions.md b/crates/gitea-client/docs/OrganizationPermissions.md index 7a964fa..d7370fd 100644 --- a/crates/gitea-client/docs/OrganizationPermissions.md +++ b/crates/gitea-client/docs/OrganizationPermissions.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**can_create_repository** | Option<**bool**> | | [optional] -**can_read** | Option<**bool**> | | [optional] -**can_write** | Option<**bool**> | | [optional] -**is_admin** | Option<**bool**> | | [optional] -**is_owner** | Option<**bool**> | | [optional] +**can_create_repository** | Option<**bool**> | Whether the user can create repositories in the organization | [optional] +**can_read** | Option<**bool**> | Whether the user can read the organization | [optional] +**can_write** | Option<**bool**> | Whether the user can write to the organization | [optional] +**is_admin** | Option<**bool**> | Whether the user is an admin of the organization | [optional] +**is_owner** | Option<**bool**> | Whether the user is an owner of the organization | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Package.md b/crates/gitea-client/docs/Package.md index 29ef457..cb5f3bf 100644 --- a/crates/gitea-client/docs/Package.md +++ b/crates/gitea-client/docs/Package.md @@ -6,13 +6,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | Option<**String**> | | [optional] **creator** | Option<[**models::User**](User.md)> | | [optional] -**html_url** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**name** | Option<**String**> | | [optional] +**html_url** | Option<**String**> | The HTML URL to view the package | [optional] +**id** | Option<**i64**> | The unique identifier of the package | [optional] +**name** | Option<**String**> | The name of the package | [optional] **owner** | Option<[**models::User**](User.md)> | | [optional] **repository** | Option<[**models::Repository**](Repository.md)> | | [optional] -**r#type** | Option<**String**> | | [optional] -**version** | Option<**String**> | | [optional] +**r#type** | Option<**String**> | The type of the package (e.g., npm, maven, docker) | [optional] +**version** | Option<**String**> | The version of the package | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/PackageApi.md b/crates/gitea-client/docs/PackageApi.md index 0a401f9..62057b0 100644 --- a/crates/gitea-client/docs/PackageApi.md +++ b/crates/gitea-client/docs/PackageApi.md @@ -5,9 +5,13 @@ All URIs are relative to */api/v1* Method | HTTP request | Description ------------- | ------------- | ------------- [**delete_package**](PackageApi.md#delete_package) | **DELETE** /packages/{owner}/{type}/{name}/{version} | Delete a package +[**get_latest_package_version**](PackageApi.md#get_latest_package_version) | **GET** /packages/{owner}/{type}/{name}/-/latest | Gets the latest version of a package [**get_package**](PackageApi.md#get_package) | **GET** /packages/{owner}/{type}/{name}/{version} | Gets a package +[**link_package**](PackageApi.md#link_package) | **POST** /packages/{owner}/{type}/{name}/-/link/{repo_name} | Link a package to a repository [**list_package_files**](PackageApi.md#list_package_files) | **GET** /packages/{owner}/{type}/{name}/{version}/files | Gets all files of a package +[**list_package_versions**](PackageApi.md#list_package_versions) | **GET** /packages/{owner}/{type}/{name} | Gets all versions of a package [**list_packages**](PackageApi.md#list_packages) | **GET** /packages/{owner} | Gets all packages of an owner +[**unlink_package**](PackageApi.md#unlink_package) | **POST** /packages/{owner}/{type}/{name}/-/unlink | Unlink a package from a repository @@ -42,6 +46,36 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## get_latest_package_version + +> models::Package get_latest_package_version(owner, r#type, name) +Gets the latest version of a package + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the package | [required] | +**r#type** | **String** | type of the package | [required] | +**name** | **String** | name of the package | [required] | + +### Return type + +[**models::Package**](Package.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## get_package > models::Package get_package(owner, r#type, name, version) @@ -73,6 +107,37 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## link_package + +> link_package(owner, r#type, name, repo_name) +Link a package to a repository + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the package | [required] | +**r#type** | **String** | type of the package | [required] | +**name** | **String** | name of the package | [required] | +**repo_name** | **String** | name of the repository to link. | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## list_package_files > Vec list_package_files(owner, r#type, name, version) @@ -104,6 +169,38 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## list_package_versions + +> Vec list_package_versions(owner, r#type, name, page, limit) +Gets all versions of a package + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the package | [required] | +**r#type** | **String** | type of the package | [required] | +**name** | **String** | name of the package | [required] | +**page** | Option<**i32**> | page number of results to return (1-based) | | +**limit** | Option<**i32**> | page size of results | | + +### Return type + +[**Vec**](Package.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## list_packages > Vec list_packages(owner, page, limit, r#type, q) @@ -135,3 +232,33 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +## unlink_package + +> unlink_package(owner, r#type, name) +Unlink a package from a repository + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the package | [required] | +**r#type** | **String** | type of the package | [required] | +**name** | **String** | name of the package | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/crates/gitea-client/docs/PackageFile.md b/crates/gitea-client/docs/PackageFile.md index 772bfb0..621b604 100644 --- a/crates/gitea-client/docs/PackageFile.md +++ b/crates/gitea-client/docs/PackageFile.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**size** | Option<**i64**> | | [optional] -**id** | Option<**i64**> | | [optional] -**md5** | Option<**String**> | | [optional] -**name** | Option<**String**> | | [optional] -**sha1** | Option<**String**> | | [optional] -**sha256** | Option<**String**> | | [optional] -**sha512** | Option<**String**> | | [optional] +**id** | Option<**i64**> | The unique identifier of the package file | [optional] +**md5** | Option<**String**> | The MD5 hash of the package file | [optional] +**name** | Option<**String**> | The name of the package file | [optional] +**sha1** | Option<**String**> | The SHA1 hash of the package file | [optional] +**sha256** | Option<**String**> | The SHA256 hash of the package file | [optional] +**sha512** | Option<**String**> | The SHA512 hash of the package file | [optional] +**size** | Option<**i64**> | The size of the package file in bytes | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/PayloadCommit.md b/crates/gitea-client/docs/PayloadCommit.md index cf9126f..3424f62 100644 --- a/crates/gitea-client/docs/PayloadCommit.md +++ b/crates/gitea-client/docs/PayloadCommit.md @@ -4,15 +4,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**added** | Option<**Vec**> | | [optional] +**added** | Option<**Vec**> | List of files added in this commit | [optional] **author** | Option<[**models::PayloadUser**](PayloadUser.md)> | | [optional] **committer** | Option<[**models::PayloadUser**](PayloadUser.md)> | | [optional] **id** | Option<**String**> | sha1 hash of the commit | [optional] -**message** | Option<**String**> | | [optional] -**modified** | Option<**Vec**> | | [optional] -**removed** | Option<**Vec**> | | [optional] +**message** | Option<**String**> | The commit message | [optional] +**modified** | Option<**Vec**> | List of files modified in this commit | [optional] +**removed** | Option<**Vec**> | List of files removed in this commit | [optional] **timestamp** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**url** | Option<**String**> | The URL to view this commit | [optional] **verification** | Option<[**models::PayloadCommitVerification**](PayloadCommitVerification.md)> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/PayloadCommitVerification.md b/crates/gitea-client/docs/PayloadCommitVerification.md index d6e7c6c..b90ce59 100644 --- a/crates/gitea-client/docs/PayloadCommitVerification.md +++ b/crates/gitea-client/docs/PayloadCommitVerification.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**payload** | Option<**String**> | | [optional] -**reason** | Option<**String**> | | [optional] -**signature** | Option<**String**> | | [optional] +**payload** | Option<**String**> | The signed payload content | [optional] +**reason** | Option<**String**> | The reason for the verification status | [optional] +**signature** | Option<**String**> | The GPG signature of the commit | [optional] **signer** | Option<[**models::PayloadUser**](PayloadUser.md)> | | [optional] -**verified** | Option<**bool**> | | [optional] +**verified** | Option<**bool**> | Whether the commit signature is verified | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/PayloadUser.md b/crates/gitea-client/docs/PayloadUser.md index 2a1065b..e237cca 100644 --- a/crates/gitea-client/docs/PayloadUser.md +++ b/crates/gitea-client/docs/PayloadUser.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **email** | Option<**String**> | | [optional] **name** | Option<**String**> | Full name of the commit author | [optional] -**username** | Option<**String**> | | [optional] +**username** | Option<**String**> | username of the user | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/PrBranchInfo.md b/crates/gitea-client/docs/PrBranchInfo.md index 1cfd8a0..da22eb4 100644 --- a/crates/gitea-client/docs/PrBranchInfo.md +++ b/crates/gitea-client/docs/PrBranchInfo.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**label** | Option<**String**> | | [optional] -**r#ref** | Option<**String**> | | [optional] +**label** | Option<**String**> | The display name of the branch | [optional] +**r#ref** | Option<**String**> | The git reference of the branch | [optional] **repo** | Option<[**models::Repository**](Repository.md)> | | [optional] -**repo_id** | Option<**i64**> | | [optional] -**sha** | Option<**String**> | | [optional] +**repo_id** | Option<**i64**> | The unique identifier of the repository | [optional] +**sha** | Option<**String**> | The commit SHA of the branch head | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/PublicKey.md b/crates/gitea-client/docs/PublicKey.md index 39ee65a..774e08d 100644 --- a/crates/gitea-client/docs/PublicKey.md +++ b/crates/gitea-client/docs/PublicKey.md @@ -5,13 +5,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | Option<**String**> | | [optional] -**fingerprint** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**key** | Option<**String**> | | [optional] -**key_type** | Option<**String**> | | [optional] -**read_only** | Option<**bool**> | | [optional] -**title** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**fingerprint** | Option<**String**> | Fingerprint is the key's fingerprint | [optional] +**id** | Option<**i64**> | ID is the unique identifier for the public key | [optional] +**key** | Option<**String**> | Key contains the actual SSH public key content | [optional] +**key_type** | Option<**String**> | KeyType indicates the type of the SSH key | [optional] +**last_used_at** | Option<**String**> | Updated is the time when the key was last used | [optional] +**read_only** | Option<**bool**> | ReadOnly indicates if the key has read-only access | [optional] +**title** | Option<**String**> | Title is the human-readable name for the key | [optional] +**url** | Option<**String**> | URL is the API URL for this key | [optional] **user** | Option<[**models::User**](User.md)> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/PullRequest.md b/crates/gitea-client/docs/PullRequest.md index 95ef4bb..0e9b748 100644 --- a/crates/gitea-client/docs/PullRequest.md +++ b/crates/gitea-client/docs/PullRequest.md @@ -4,41 +4,42 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**additions** | Option<**i64**> | | [optional] -**allow_maintainer_edit** | Option<**bool**> | | [optional] +**additions** | Option<**i64**> | The number of lines added in the pull request | [optional] +**allow_maintainer_edit** | Option<**bool**> | Whether maintainers can edit the pull request | [optional] **assignee** | Option<[**models::User**](User.md)> | | [optional] -**assignees** | Option<[**Vec**](User.md)> | | [optional] +**assignees** | Option<[**Vec**](User.md)> | The list of users assigned to the pull request | [optional] **base** | Option<[**models::PrBranchInfo**](PRBranchInfo.md)> | | [optional] -**body** | Option<**String**> | | [optional] -**changed_files** | Option<**i64**> | | [optional] +**body** | Option<**String**> | The description body of the pull request | [optional] +**changed_files** | Option<**i64**> | The number of files changed in the pull request | [optional] **closed_at** | Option<**String**> | | [optional] -**comments** | Option<**i64**> | | [optional] +**comments** | Option<**i64**> | The number of comments on the pull request | [optional] **created_at** | Option<**String**> | | [optional] -**deletions** | Option<**i64**> | | [optional] -**diff_url** | Option<**String**> | | [optional] -**draft** | Option<**bool**> | | [optional] +**deletions** | Option<**i64**> | The number of lines deleted in the pull request | [optional] +**diff_url** | Option<**String**> | The URL to download the diff patch | [optional] +**draft** | Option<**bool**> | Whether the pull request is a draft | [optional] **due_date** | Option<**String**> | | [optional] **head** | Option<[**models::PrBranchInfo**](PRBranchInfo.md)> | | [optional] -**html_url** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**is_locked** | Option<**bool**> | | [optional] -**labels** | Option<[**Vec**](Label.md)> | | [optional] -**merge_base** | Option<**String**> | | [optional] -**merge_commit_sha** | Option<**String**> | | [optional] -**mergeable** | Option<**bool**> | | [optional] -**merged** | Option<**bool**> | | [optional] +**html_url** | Option<**String**> | The HTML URL to view the pull request | [optional] +**id** | Option<**i64**> | The unique identifier of the pull request | [optional] +**is_locked** | Option<**bool**> | Whether the pull request conversation is locked | [optional] +**labels** | Option<[**Vec**](Label.md)> | The labels attached to the pull request | [optional] +**merge_base** | Option<**String**> | The merge base commit SHA | [optional] +**merge_commit_sha** | Option<**String**> | The SHA of the merge commit | [optional] +**mergeable** | Option<**bool**> | Whether the pull request can be merged | [optional] +**merged** | Option<**bool**> | Whether the pull request has been merged | [optional] **merged_at** | Option<**String**> | | [optional] **merged_by** | Option<[**models::User**](User.md)> | | [optional] **milestone** | Option<[**models::Milestone**](Milestone.md)> | | [optional] -**number** | Option<**i64**> | | [optional] -**patch_url** | Option<**String**> | | [optional] -**pin_order** | Option<**i64**> | | [optional] -**requested_reviewers** | Option<[**Vec**](User.md)> | | [optional] +**number** | Option<**i64**> | The pull request number | [optional] +**patch_url** | Option<**String**> | The URL to download the patch file | [optional] +**pin_order** | Option<**i64**> | The pin order for the pull request | [optional] +**requested_reviewers** | Option<[**Vec**](User.md)> | The users requested to review the pull request | [optional] +**requested_reviewers_teams** | Option<[**Vec**](Team.md)> | The teams requested to review the pull request | [optional] **review_comments** | Option<**i64**> | number of review comments made on the diff of a PR review (not including comments on commits or issues in a PR) | [optional] **state** | Option<**String**> | StateType issue state type | [optional] -**title** | Option<**String**> | | [optional] +**title** | Option<**String**> | The title of the pull request | [optional] **updated_at** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**url** | Option<**String**> | The API URL of the pull request | [optional] **user** | Option<[**models::User**](User.md)> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/PullReview.md b/crates/gitea-client/docs/PullReview.md index 006b465..55979a7 100644 --- a/crates/gitea-client/docs/PullReview.md +++ b/crates/gitea-client/docs/PullReview.md @@ -8,10 +8,10 @@ Name | Type | Description | Notes **comments_count** | Option<**i64**> | | [optional] **commit_id** | Option<**String**> | | [optional] **dismissed** | Option<**bool**> | | [optional] -**html_url** | Option<**String**> | | [optional] +**html_url** | Option<**String**> | HTMLURL is the web URL for viewing the review | [optional] **id** | Option<**i64**> | | [optional] **official** | Option<**bool**> | | [optional] -**pull_request_url** | Option<**String**> | | [optional] +**pull_request_url** | Option<**String**> | HTMLPullURL is the web URL for the pull request | [optional] **stale** | Option<**bool**> | | [optional] **state** | Option<**String**> | ReviewStateType review state type | [optional] **submitted_at** | Option<**String**> | | [optional] diff --git a/crates/gitea-client/docs/PushMirror.md b/crates/gitea-client/docs/PushMirror.md index 6544bd0..2623128 100644 --- a/crates/gitea-client/docs/PushMirror.md +++ b/crates/gitea-client/docs/PushMirror.md @@ -5,13 +5,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created** | Option<**String**> | | [optional] -**interval** | Option<**String**> | | [optional] -**last_error** | Option<**String**> | | [optional] +**interval** | Option<**String**> | The sync interval for automatic updates | [optional] +**last_error** | Option<**String**> | The last error message encountered during sync | [optional] **last_update** | Option<**String**> | | [optional] -**remote_address** | Option<**String**> | | [optional] -**remote_name** | Option<**String**> | | [optional] -**repo_name** | Option<**String**> | | [optional] -**sync_on_commit** | Option<**bool**> | | [optional] +**remote_address** | Option<**String**> | The remote repository URL being mirrored to | [optional] +**remote_name** | Option<**String**> | The name of the remote in the git configuration | [optional] +**repo_name** | Option<**String**> | The name of the source repository | [optional] +**sync_on_commit** | Option<**bool**> | Whether to sync on every commit | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Reaction.md b/crates/gitea-client/docs/Reaction.md index df4f20a..69e804c 100644 --- a/crates/gitea-client/docs/Reaction.md +++ b/crates/gitea-client/docs/Reaction.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**content** | Option<**String**> | | [optional] +**content** | Option<**String**> | The reaction content (e.g., emoji or reaction type) | [optional] **created_at** | Option<**String**> | | [optional] **user** | Option<[**models::User**](User.md)> | | [optional] diff --git a/crates/gitea-client/docs/Reference.md b/crates/gitea-client/docs/Reference.md index 7698c9b..fc00a6d 100644 --- a/crates/gitea-client/docs/Reference.md +++ b/crates/gitea-client/docs/Reference.md @@ -5,8 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **object** | Option<[**models::GitObject**](GitObject.md)> | | [optional] -**r#ref** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] +**r#ref** | Option<**String**> | The name of the Git reference (e.g., refs/heads/main) | [optional] +**url** | Option<**String**> | The URL to access this Git reference | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Release.md b/crates/gitea-client/docs/Release.md index 264b282..5f6e7ec 100644 --- a/crates/gitea-client/docs/Release.md +++ b/crates/gitea-client/docs/Release.md @@ -4,22 +4,22 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**assets** | Option<[**Vec**](Attachment.md)> | | [optional] +**assets** | Option<[**Vec**](Attachment.md)> | The files attached to the release | [optional] **author** | Option<[**models::User**](User.md)> | | [optional] -**body** | Option<**String**> | | [optional] +**body** | Option<**String**> | The release notes or description | [optional] **created_at** | Option<**String**> | | [optional] -**draft** | Option<**bool**> | | [optional] -**html_url** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**name** | Option<**String**> | | [optional] -**prerelease** | Option<**bool**> | | [optional] +**draft** | Option<**bool**> | Whether the release is a draft | [optional] +**html_url** | Option<**String**> | The HTML URL to view the release | [optional] +**id** | Option<**i64**> | The unique identifier of the release | [optional] +**name** | Option<**String**> | The display title of the release | [optional] +**prerelease** | Option<**bool**> | Whether the release is a prerelease | [optional] **published_at** | Option<**String**> | | [optional] -**tag_name** | Option<**String**> | | [optional] -**tarball_url** | Option<**String**> | | [optional] -**target_commitish** | Option<**String**> | | [optional] -**upload_url** | Option<**String**> | | [optional] -**url** | Option<**String**> | | [optional] -**zipball_url** | Option<**String**> | | [optional] +**tag_name** | Option<**String**> | The name of the git tag associated with the release | [optional] +**tarball_url** | Option<**String**> | The URL to download the tarball archive | [optional] +**target_commitish** | Option<**String**> | The target commitish for the release | [optional] +**upload_url** | Option<**String**> | The URL template for uploading release assets | [optional] +**url** | Option<**String**> | The API URL of the release | [optional] +**zipball_url** | Option<**String**> | The URL to download the zip archive | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/RenameBranchRepoOption.md b/crates/gitea-client/docs/RenameBranchRepoOption.md new file mode 100644 index 0000000..61c7d48 --- /dev/null +++ b/crates/gitea-client/docs/RenameBranchRepoOption.md @@ -0,0 +1,11 @@ +# RenameBranchRepoOption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | New branch name | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/RenameOrgOption.md b/crates/gitea-client/docs/RenameOrgOption.md new file mode 100644 index 0000000..90eadf9 --- /dev/null +++ b/crates/gitea-client/docs/RenameOrgOption.md @@ -0,0 +1,11 @@ +# RenameOrgOption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**new_name** | **String** | New username for this org. This name cannot be in use yet by any other user. | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/RepoCollaboratorPermission.md b/crates/gitea-client/docs/RepoCollaboratorPermission.md index d748229..284fc20 100644 --- a/crates/gitea-client/docs/RepoCollaboratorPermission.md +++ b/crates/gitea-client/docs/RepoCollaboratorPermission.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**permission** | Option<**String**> | | [optional] -**role_name** | Option<**String**> | | [optional] +**permission** | Option<**String**> | Permission level of the collaborator | [optional] +**role_name** | Option<**String**> | RoleName is the name of the permission role | [optional] **user** | Option<[**models::User**](User.md)> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/RepoCommit.md b/crates/gitea-client/docs/RepoCommit.md index e40fe3d..2e0e253 100644 --- a/crates/gitea-client/docs/RepoCommit.md +++ b/crates/gitea-client/docs/RepoCommit.md @@ -6,9 +6,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **author** | Option<[**models::CommitUser**](CommitUser.md)> | | [optional] **committer** | Option<[**models::CommitUser**](CommitUser.md)> | | [optional] -**message** | Option<**String**> | | [optional] +**message** | Option<**String**> | Message is the commit message | [optional] **tree** | Option<[**models::CommitMeta**](CommitMeta.md)> | | [optional] -**url** | Option<**String**> | | [optional] +**url** | Option<**String**> | URL is the API URL for the commit | [optional] **verification** | Option<[**models::PayloadCommitVerification**](PayloadCommitVerification.md)> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/RepoCreateReleaseAttachmentRequest.md b/crates/gitea-client/docs/RepoCreateReleaseAttachmentRequest.md index 126e44c..8be99f2 100644 --- a/crates/gitea-client/docs/RepoCreateReleaseAttachmentRequest.md +++ b/crates/gitea-client/docs/RepoCreateReleaseAttachmentRequest.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**attachment** | Option<[**std::path::PathBuf**](std::path::PathBuf.md)> | attachment to upload | [optional] +**attachment** | Option<**std::path::PathBuf**> | attachment to upload | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Repository.md b/crates/gitea-client/docs/Repository.md index 579e333..68a5668 100644 --- a/crates/gitea-client/docs/Repository.md +++ b/crates/gitea-client/docs/Repository.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **allow_fast_forward_only_merge** | Option<**bool**> | | [optional] +**allow_manual_merge** | Option<**bool**> | | [optional] **allow_merge_commits** | Option<**bool**> | | [optional] **allow_rebase** | Option<**bool**> | | [optional] **allow_rebase_explicit** | Option<**bool**> | | [optional] @@ -12,6 +13,7 @@ Name | Type | Description | Notes **allow_squash_merge** | Option<**bool**> | | [optional] **archived** | Option<**bool**> | | [optional] **archived_at** | Option<**String**> | | [optional] +**autodetect_manual_merge** | Option<**bool**> | | [optional] **avatar_url** | Option<**String**> | | [optional] **clone_url** | Option<**String**> | | [optional] **created_at** | Option<**String**> | | [optional] @@ -27,6 +29,7 @@ Name | Type | Description | Notes **forks_count** | Option<**i64**> | | [optional] **full_name** | Option<**String**> | | [optional] **has_actions** | Option<**bool**> | | [optional] +**has_code** | Option<**bool**> | | [optional] **has_issues** | Option<**bool**> | | [optional] **has_packages** | Option<**bool**> | | [optional] **has_projects** | Option<**bool**> | | [optional] @@ -40,12 +43,13 @@ Name | Type | Description | Notes **internal_tracker** | Option<[**models::InternalTracker**](InternalTracker.md)> | | [optional] **language** | Option<**String**> | | [optional] **languages_url** | Option<**String**> | | [optional] +**licenses** | Option<**Vec**> | | [optional] **link** | Option<**String**> | | [optional] **mirror** | Option<**bool**> | | [optional] **mirror_interval** | Option<**String**> | | [optional] **mirror_updated** | Option<**String**> | | [optional] **name** | Option<**String**> | | [optional] -**object_format_name** | Option<**String**> | ObjectFormatName of the underlying git repository | [optional] +**object_format_name** | Option<**ObjectFormatName**> | ObjectFormatName of the underlying git repository (enum: sha1, sha256) | [optional] **open_issues_count** | Option<**i64**> | | [optional] **open_pr_counter** | Option<**i64**> | | [optional] **original_url** | Option<**String**> | | [optional] @@ -60,6 +64,7 @@ Name | Type | Description | Notes **ssh_url** | Option<**String**> | | [optional] **stars_count** | Option<**i64**> | | [optional] **template** | Option<**bool**> | | [optional] +**topics** | Option<**Vec**> | | [optional] **updated_at** | Option<**String**> | | [optional] **url** | Option<**String**> | | [optional] **watchers_count** | Option<**i64**> | | [optional] diff --git a/crates/gitea-client/docs/RepositoryApi.md b/crates/gitea-client/docs/RepositoryApi.md index 26f3c19..c85b06d 100644 --- a/crates/gitea-client/docs/RepositoryApi.md +++ b/crates/gitea-client/docs/RepositoryApi.md @@ -5,20 +5,41 @@ All URIs are relative to */api/v1* Method | HTTP request | Description ------------- | ------------- | ------------- [**accept_repo_transfer**](RepositoryApi.md#accept_repo_transfer) | **POST** /repos/{owner}/{repo}/transfer/accept | Accept a repo transfer +[**actions_disable_workflow**](RepositoryApi.md#actions_disable_workflow) | **PUT** /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable | Disable a workflow +[**actions_dispatch_workflow**](RepositoryApi.md#actions_dispatch_workflow) | **POST** /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches | Create a workflow dispatch event +[**actions_enable_workflow**](RepositoryApi.md#actions_enable_workflow) | **PUT** /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable | Enable a workflow +[**actions_get_workflow**](RepositoryApi.md#actions_get_workflow) | **GET** /repos/{owner}/{repo}/actions/workflows/{workflow_id} | Get a workflow +[**actions_list_repository_workflows**](RepositoryApi.md#actions_list_repository_workflows) | **GET** /repos/{owner}/{repo}/actions/workflows | List repository workflows [**create_current_user_repo**](RepositoryApi.md#create_current_user_repo) | **POST** /user/repos | Create a repository [**create_fork**](RepositoryApi.md#create_fork) | **POST** /repos/{owner}/{repo}/forks | Fork a repository [**create_repo_variable**](RepositoryApi.md#create_repo_variable) | **POST** /repos/{owner}/{repo}/actions/variables/{variablename} | Create a repo-level variable +[**delete_action_run**](RepositoryApi.md#delete_action_run) | **DELETE** /repos/{owner}/{repo}/actions/runs/{run} | Delete a workflow run +[**delete_artifact**](RepositoryApi.md#delete_artifact) | **DELETE** /repos/{owner}/{repo}/actions/artifacts/{artifact_id} | Deletes a specific artifact for a workflow run +[**delete_repo_runner**](RepositoryApi.md#delete_repo_runner) | **DELETE** /repos/{owner}/{repo}/actions/runners/{runner_id} | Delete an repo-level runner [**delete_repo_secret**](RepositoryApi.md#delete_repo_secret) | **DELETE** /repos/{owner}/{repo}/actions/secrets/{secretname} | Delete a secret in a repository [**delete_repo_variable**](RepositoryApi.md#delete_repo_variable) | **DELETE** /repos/{owner}/{repo}/actions/variables/{variablename} | Delete a repo-level variable +[**download_actions_run_job_logs**](RepositoryApi.md#download_actions_run_job_logs) | **GET** /repos/{owner}/{repo}/actions/jobs/{job_id}/logs | Downloads the job logs for a workflow run +[**download_artifact**](RepositoryApi.md#download_artifact) | **GET** /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/zip | Downloads a specific artifact for a workflow run redirects to blob url [**generate_repo**](RepositoryApi.md#generate_repo) | **POST** /repos/{template_owner}/{template_repo}/generate | Create a repository using a template [**get_annotated_tag**](RepositoryApi.md#get_annotated_tag) | **GET** /repos/{owner}/{repo}/git/tags/{sha} | Gets the tag object of an annotated tag (not lightweight tags) +[**get_artifact**](RepositoryApi.md#get_artifact) | **GET** /repos/{owner}/{repo}/actions/artifacts/{artifact_id} | Gets a specific artifact for a workflow run +[**get_artifacts**](RepositoryApi.md#get_artifacts) | **GET** /repos/{owner}/{repo}/actions/artifacts | Lists all artifacts for a repository +[**get_artifacts_of_run**](RepositoryApi.md#get_artifacts_of_run) | **GET** /repos/{owner}/{repo}/actions/runs/{run}/artifacts | Lists all artifacts for a repository run [**get_blob**](RepositoryApi.md#get_blob) | **GET** /repos/{owner}/{repo}/git/blobs/{sha} | Gets the blob of a repository. +[**get_repo_runner**](RepositoryApi.md#get_repo_runner) | **GET** /repos/{owner}/{repo}/actions/runners/{runner_id} | Get an repo-level runner +[**get_repo_runners**](RepositoryApi.md#get_repo_runners) | **GET** /repos/{owner}/{repo}/actions/runners | Get repo-level runners [**get_repo_variable**](RepositoryApi.md#get_repo_variable) | **GET** /repos/{owner}/{repo}/actions/variables/{variablename} | Get a repo-level variable [**get_repo_variables_list**](RepositoryApi.md#get_repo_variables_list) | **GET** /repos/{owner}/{repo}/actions/variables | Get repo-level variables list [**get_tree**](RepositoryApi.md#get_tree) | **GET** /repos/{owner}/{repo}/git/trees/{sha} | Gets the tree of a repository. +[**get_workflow_job**](RepositoryApi.md#get_workflow_job) | **GET** /repos/{owner}/{repo}/actions/jobs/{job_id} | Gets a specific workflow job for a workflow run +[**get_workflow_run**](RepositoryApi.md#get_workflow_run) | **GET** /repos/{owner}/{repo}/actions/runs/{run} | Gets a specific workflow run +[**get_workflow_runs**](RepositoryApi.md#get_workflow_runs) | **GET** /repos/{owner}/{repo}/actions/runs | Lists all runs for a repository run +[**list_action_tasks**](RepositoryApi.md#list_action_tasks) | **GET** /repos/{owner}/{repo}/actions/tasks | List a repository's action tasks [**list_forks**](RepositoryApi.md#list_forks) | **GET** /repos/{owner}/{repo}/forks | List a repository's forks +[**list_workflow_jobs**](RepositoryApi.md#list_workflow_jobs) | **GET** /repos/{owner}/{repo}/actions/jobs | Lists all jobs for a repository +[**list_workflow_run_jobs**](RepositoryApi.md#list_workflow_run_jobs) | **GET** /repos/{owner}/{repo}/actions/runs/{run}/jobs | Lists all jobs for a workflow run [**reject_repo_transfer**](RepositoryApi.md#reject_repo_transfer) | **POST** /repos/{owner}/{repo}/transfer/reject | Reject a repo transfer -[**repo_add_collaborator**](RepositoryApi.md#repo_add_collaborator) | **PUT** /repos/{owner}/{repo}/collaborators/{collaborator} | Add a collaborator to a repository +[**repo_add_collaborator**](RepositoryApi.md#repo_add_collaborator) | **PUT** /repos/{owner}/{repo}/collaborators/{collaborator} | Add or Update a collaborator to a repository [**repo_add_push_mirror**](RepositoryApi.md#repo_add_push_mirror) | **POST** /repos/{owner}/{repo}/push_mirrors | add a push mirror to the repository [**repo_add_team**](RepositoryApi.md#repo_add_team) | **PUT** /repos/{owner}/{repo}/teams/{team} | Add a team to a repository [**repo_add_topic**](RepositoryApi.md#repo_add_topic) | **PUT** /repos/{owner}/{repo}/topics/{topic} | Add a topic to a repository @@ -38,8 +59,10 @@ Method | HTTP request | Description [**repo_create_pull_review_requests**](RepositoryApi.md#repo_create_pull_review_requests) | **POST** /repos/{owner}/{repo}/pulls/{index}/requested_reviewers | create review requests for a pull request [**repo_create_release**](RepositoryApi.md#repo_create_release) | **POST** /repos/{owner}/{repo}/releases | Create a release [**repo_create_release_attachment**](RepositoryApi.md#repo_create_release_attachment) | **POST** /repos/{owner}/{repo}/releases/{id}/assets | Create a release attachment +[**repo_create_runner_registration_token**](RepositoryApi.md#repo_create_runner_registration_token) | **POST** /repos/{owner}/{repo}/actions/runners/registration-token | Get a repository's actions runner registration token [**repo_create_status**](RepositoryApi.md#repo_create_status) | **POST** /repos/{owner}/{repo}/statuses/{sha} | Create a commit status [**repo_create_tag**](RepositoryApi.md#repo_create_tag) | **POST** /repos/{owner}/{repo}/tags | Create a new git tag in a repository +[**repo_create_tag_protection**](RepositoryApi.md#repo_create_tag_protection) | **POST** /repos/{owner}/{repo}/tag_protections | Create a tag protections for a repository [**repo_create_wiki_page**](RepositoryApi.md#repo_create_wiki_page) | **POST** /repos/{owner}/{repo}/wiki/new | Create a wiki page [**repo_delete**](RepositoryApi.md#repo_delete) | **DELETE** /repos/{owner}/{repo} | Delete a repository [**repo_delete_avatar**](RepositoryApi.md#repo_delete_avatar) | **DELETE** /repos/{owner}/{repo}/avatar | Delete avatar @@ -57,6 +80,7 @@ Method | HTTP request | Description [**repo_delete_release_attachment**](RepositoryApi.md#repo_delete_release_attachment) | **DELETE** /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id} | Delete a release attachment [**repo_delete_release_by_tag**](RepositoryApi.md#repo_delete_release_by_tag) | **DELETE** /repos/{owner}/{repo}/releases/tags/{tag} | Delete a release by tag name [**repo_delete_tag**](RepositoryApi.md#repo_delete_tag) | **DELETE** /repos/{owner}/{repo}/tags/{tag} | Delete a repository's tag by name +[**repo_delete_tag_protection**](RepositoryApi.md#repo_delete_tag_protection) | **DELETE** /repos/{owner}/{repo}/tag_protections/{id} | Delete a specific tag protection for the repository [**repo_delete_team**](RepositoryApi.md#repo_delete_team) | **DELETE** /repos/{owner}/{repo}/teams/{team} | Delete a team from a repository [**repo_delete_topic**](RepositoryApi.md#repo_delete_topic) | **DELETE** /repos/{owner}/{repo}/topics/{topic} | Delete a topic from a repository [**repo_delete_wiki_page**](RepositoryApi.md#repo_delete_wiki_page) | **DELETE** /repos/{owner}/{repo}/wiki/page/{pageName} | Delete a wiki page @@ -70,6 +94,7 @@ Method | HTTP request | Description [**repo_edit_pull_request**](RepositoryApi.md#repo_edit_pull_request) | **PATCH** /repos/{owner}/{repo}/pulls/{index} | Update a pull request. If using deadline only the date will be taken into account, and time of day ignored. [**repo_edit_release**](RepositoryApi.md#repo_edit_release) | **PATCH** /repos/{owner}/{repo}/releases/{id} | Update a release [**repo_edit_release_attachment**](RepositoryApi.md#repo_edit_release_attachment) | **PATCH** /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id} | Edit a release attachment +[**repo_edit_tag_protection**](RepositoryApi.md#repo_edit_tag_protection) | **PATCH** /repos/{owner}/{repo}/tag_protections/{id} | Edit a tag protections for a repository. Only fields that are set will be changed [**repo_edit_wiki_page**](RepositoryApi.md#repo_edit_wiki_page) | **PATCH** /repos/{owner}/{repo}/wiki/page/{pageName} | Edit a wiki page [**repo_get**](RepositoryApi.md#repo_get) | **GET** /repos/{owner}/{repo} | Get a repository [**repo_get_all_commits**](RepositoryApi.md#repo_get_all_commits) | **GET** /repos/{owner}/{repo}/commits | Get a list of all commits from a repository @@ -79,10 +104,13 @@ Method | HTTP request | Description [**repo_get_branch_protection**](RepositoryApi.md#repo_get_branch_protection) | **GET** /repos/{owner}/{repo}/branch_protections/{name} | Get a specific branch protection for the repository [**repo_get_by_id**](RepositoryApi.md#repo_get_by_id) | **GET** /repositories/{id} | Get a repository by id [**repo_get_combined_status_by_ref**](RepositoryApi.md#repo_get_combined_status_by_ref) | **GET** /repos/{owner}/{repo}/commits/{ref}/status | Get a commit's combined status, by branch/tag/commit reference -[**repo_get_commit_pull_request**](RepositoryApi.md#repo_get_commit_pull_request) | **GET** /repos/{owner}/{repo}/commits/{sha}/pull | Get the pull request of the commit -[**repo_get_contents**](RepositoryApi.md#repo_get_contents) | **GET** /repos/{owner}/{repo}/contents/{filepath} | Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir -[**repo_get_contents_list**](RepositoryApi.md#repo_get_contents_list) | **GET** /repos/{owner}/{repo}/contents | Gets the metadata of all the entries of the root dir +[**repo_get_commit_pull_request**](RepositoryApi.md#repo_get_commit_pull_request) | **GET** /repos/{owner}/{repo}/commits/{sha}/pull | Get the merged pull request of the commit +[**repo_get_contents**](RepositoryApi.md#repo_get_contents) | **GET** /repos/{owner}/{repo}/contents/{filepath} | Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir. +[**repo_get_contents_ext**](RepositoryApi.md#repo_get_contents_ext) | **GET** /repos/{owner}/{repo}/contents-ext/{filepath} | The extended \"contents\" API, to get file metadata and/or content, or list a directory. +[**repo_get_contents_list**](RepositoryApi.md#repo_get_contents_list) | **GET** /repos/{owner}/{repo}/contents | Gets the metadata of all the entries of the root dir. [**repo_get_editor_config**](RepositoryApi.md#repo_get_editor_config) | **GET** /repos/{owner}/{repo}/editorconfig/{filepath} | Get the EditorConfig definitions of a file in a repository +[**repo_get_file_contents**](RepositoryApi.md#repo_get_file_contents) | **GET** /repos/{owner}/{repo}/file-contents | Get the metadata and contents of requested files +[**repo_get_file_contents_post**](RepositoryApi.md#repo_get_file_contents_post) | **POST** /repos/{owner}/{repo}/file-contents | Get the metadata and contents of requested files [**repo_get_git_hook**](RepositoryApi.md#repo_get_git_hook) | **GET** /repos/{owner}/{repo}/hooks/git/{id} | Get a Git hook [**repo_get_hook**](RepositoryApi.md#repo_get_hook) | **GET** /repos/{owner}/{repo}/hooks/{id} | Get a hook [**repo_get_issue_config**](RepositoryApi.md#repo_get_issue_config) | **GET** /repos/{owner}/{repo}/issue_config | Returns the issue config for a repo @@ -90,6 +118,7 @@ Method | HTTP request | Description [**repo_get_key**](RepositoryApi.md#repo_get_key) | **GET** /repos/{owner}/{repo}/keys/{id} | Get a repository's key by id [**repo_get_languages**](RepositoryApi.md#repo_get_languages) | **GET** /repos/{owner}/{repo}/languages | Get languages and number of bytes of code written [**repo_get_latest_release**](RepositoryApi.md#repo_get_latest_release) | **GET** /repos/{owner}/{repo}/releases/latest | Gets the most recent non-prerelease, non-draft release of a repository, sorted by created_at +[**repo_get_licenses**](RepositoryApi.md#repo_get_licenses) | **GET** /repos/{owner}/{repo}/licenses | Get repo licenses [**repo_get_note**](RepositoryApi.md#repo_get_note) | **GET** /repos/{owner}/{repo}/git/notes/{sha} | Get a note corresponding to a single commit from a repository [**repo_get_pull_request**](RepositoryApi.md#repo_get_pull_request) | **GET** /repos/{owner}/{repo}/pulls/{index} | Get a pull request [**repo_get_pull_request_by_base_head**](RepositoryApi.md#repo_get_pull_request_by_base_head) | **GET** /repos/{owner}/{repo}/pulls/{base}/{head} | Get a pull request by base and head @@ -105,9 +134,10 @@ Method | HTTP request | Description [**repo_get_release_by_tag**](RepositoryApi.md#repo_get_release_by_tag) | **GET** /repos/{owner}/{repo}/releases/tags/{tag} | Get a release by tag name [**repo_get_repo_permissions**](RepositoryApi.md#repo_get_repo_permissions) | **GET** /repos/{owner}/{repo}/collaborators/{collaborator}/permission | Get repository permissions for a user [**repo_get_reviewers**](RepositoryApi.md#repo_get_reviewers) | **GET** /repos/{owner}/{repo}/reviewers | Return all users that can be requested to review in this repo -[**repo_get_runner_registration_token**](RepositoryApi.md#repo_get_runner_registration_token) | **GET** /repos/{owner}/{repo}/runners/registration-token | Get a repository's actions runner registration token +[**repo_get_runner_registration_token**](RepositoryApi.md#repo_get_runner_registration_token) | **GET** /repos/{owner}/{repo}/actions/runners/registration-token | Get a repository's actions runner registration token [**repo_get_single_commit**](RepositoryApi.md#repo_get_single_commit) | **GET** /repos/{owner}/{repo}/git/commits/{sha} | Get a single commit from a repository [**repo_get_tag**](RepositoryApi.md#repo_get_tag) | **GET** /repos/{owner}/{repo}/tags/{tag} | Get the tag of a repository by tag name +[**repo_get_tag_protection**](RepositoryApi.md#repo_get_tag_protection) | **GET** /repos/{owner}/{repo}/tag_protections/{id} | Get a specific tag protection for the repository [**repo_get_wiki_page**](RepositoryApi.md#repo_get_wiki_page) | **GET** /repos/{owner}/{repo}/wiki/page/{pageName} | Get a wiki page [**repo_get_wiki_page_revisions**](RepositoryApi.md#repo_get_wiki_page_revisions) | **GET** /repos/{owner}/{repo}/wiki/revisions/{pageName} | Get revisions of a wiki page [**repo_get_wiki_pages**](RepositoryApi.md#repo_get_wiki_pages) | **GET** /repos/{owner}/{repo}/wiki/pages | Get all wiki pages @@ -132,23 +162,28 @@ Method | HTTP request | Description [**repo_list_statuses**](RepositoryApi.md#repo_list_statuses) | **GET** /repos/{owner}/{repo}/statuses/{sha} | Get a commit's statuses [**repo_list_statuses_by_ref**](RepositoryApi.md#repo_list_statuses_by_ref) | **GET** /repos/{owner}/{repo}/commits/{ref}/statuses | Get a commit's statuses, by branch/tag/commit reference [**repo_list_subscribers**](RepositoryApi.md#repo_list_subscribers) | **GET** /repos/{owner}/{repo}/subscribers | List a repo's watchers +[**repo_list_tag_protection**](RepositoryApi.md#repo_list_tag_protection) | **GET** /repos/{owner}/{repo}/tag_protections | List tag protections for a repository [**repo_list_tags**](RepositoryApi.md#repo_list_tags) | **GET** /repos/{owner}/{repo}/tags | List a repository's tags [**repo_list_teams**](RepositoryApi.md#repo_list_teams) | **GET** /repos/{owner}/{repo}/teams | List a repository's teams [**repo_list_topics**](RepositoryApi.md#repo_list_topics) | **GET** /repos/{owner}/{repo}/topics | Get list of topics that a repository has [**repo_merge_pull_request**](RepositoryApi.md#repo_merge_pull_request) | **POST** /repos/{owner}/{repo}/pulls/{index}/merge | Merge a pull request +[**repo_merge_upstream**](RepositoryApi.md#repo_merge_upstream) | **POST** /repos/{owner}/{repo}/merge-upstream | Merge a branch from upstream [**repo_migrate**](RepositoryApi.md#repo_migrate) | **POST** /repos/migrate | Migrate a remote git repository [**repo_mirror_sync**](RepositoryApi.md#repo_mirror_sync) | **POST** /repos/{owner}/{repo}/mirror-sync | Sync a mirrored repository [**repo_new_pin_allowed**](RepositoryApi.md#repo_new_pin_allowed) | **GET** /repos/{owner}/{repo}/new_pin_allowed | Returns if new Issue Pins are allowed [**repo_pull_request_is_merged**](RepositoryApi.md#repo_pull_request_is_merged) | **GET** /repos/{owner}/{repo}/pulls/{index}/merge | Check if a pull request has been merged [**repo_push_mirror_sync**](RepositoryApi.md#repo_push_mirror_sync) | **POST** /repos/{owner}/{repo}/push_mirrors-sync | Sync all push mirrored repository +[**repo_rename_branch**](RepositoryApi.md#repo_rename_branch) | **PATCH** /repos/{owner}/{repo}/branches/{branch} | Rename a branch [**repo_search**](RepositoryApi.md#repo_search) | **GET** /repos/search | Search for repositories [**repo_signing_key**](RepositoryApi.md#repo_signing_key) | **GET** /repos/{owner}/{repo}/signing-key.gpg | Get signing-key.gpg for given repository +[**repo_signing_key_ssh**](RepositoryApi.md#repo_signing_key_ssh) | **GET** /repos/{owner}/{repo}/signing-key.pub | Get signing-key.pub for given repository [**repo_submit_pull_review**](RepositoryApi.md#repo_submit_pull_review) | **POST** /repos/{owner}/{repo}/pulls/{index}/reviews/{id} | Submit a pending review to an pull request [**repo_test_hook**](RepositoryApi.md#repo_test_hook) | **POST** /repos/{owner}/{repo}/hooks/{id}/tests | Test a push webhook [**repo_tracked_times**](RepositoryApi.md#repo_tracked_times) | **GET** /repos/{owner}/{repo}/times | List a repo's tracked times [**repo_transfer**](RepositoryApi.md#repo_transfer) | **POST** /repos/{owner}/{repo}/transfer | Transfer a repo ownership [**repo_un_dismiss_pull_review**](RepositoryApi.md#repo_un_dismiss_pull_review) | **POST** /repos/{owner}/{repo}/pulls/{index}/reviews/{id}/undismissals | Cancel to dismiss a review for a pull request [**repo_update_avatar**](RepositoryApi.md#repo_update_avatar) | **POST** /repos/{owner}/{repo}/avatar | Update avatar +[**repo_update_branch_protection_priories**](RepositoryApi.md#repo_update_branch_protection_priories) | **POST** /repos/{owner}/{repo}/branch_protections/priority | Update the priorities of branch protections for a repository. [**repo_update_file**](RepositoryApi.md#repo_update_file) | **PUT** /repos/{owner}/{repo}/contents/{filepath} | Update a file in a repository [**repo_update_pull_request**](RepositoryApi.md#repo_update_pull_request) | **POST** /repos/{owner}/{repo}/pulls/{index}/update | Merge PR's baseBranch into headBranch [**repo_update_topics**](RepositoryApi.md#repo_update_topics) | **PUT** /repos/{owner}/{repo}/topics | Replace list of topics for a repository @@ -192,6 +227,156 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## actions_disable_workflow + +> actions_disable_workflow(owner, repo, workflow_id) +Disable a workflow + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**workflow_id** | **String** | id of the workflow | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## actions_dispatch_workflow + +> actions_dispatch_workflow(owner, repo, workflow_id, body) +Create a workflow dispatch event + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**workflow_id** | **String** | id of the workflow | [required] | +**body** | Option<[**CreateActionWorkflowDispatch**](CreateActionWorkflowDispatch.md)> | | | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json, text/plain +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## actions_enable_workflow + +> actions_enable_workflow(owner, repo, workflow_id) +Enable a workflow + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**workflow_id** | **String** | id of the workflow | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## actions_get_workflow + +> models::ActionWorkflow actions_get_workflow(owner, repo, workflow_id) +Get a workflow + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**workflow_id** | **String** | id of the workflow | [required] | + +### Return type + +[**models::ActionWorkflow**](ActionWorkflow.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## actions_list_repository_workflows + +> models::ActionWorkflowResponse actions_list_repository_workflows(owner, repo) +List repository workflows + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | + +### Return type + +[**models::ActionWorkflowResponse**](ActionWorkflowResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## create_current_user_repo > models::Repository create_current_user_repo(body) @@ -260,7 +445,7 @@ Create a repo-level variable Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**owner** | **String** | name of the owner | [required] | +**owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repository | [required] | **variablename** | **String** | name of the variable | [required] | **body** | Option<[**CreateVariableOption**](CreateVariableOption.md)> | | | @@ -281,6 +466,96 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## delete_action_run + +> delete_action_run(owner, repo, run) +Delete a workflow run + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repository | [required] | +**run** | **i32** | runid of the workflow run | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## delete_artifact + +> delete_artifact(owner, repo, artifact_id) +Deletes a specific artifact for a workflow run + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repository | [required] | +**artifact_id** | **String** | id of the artifact | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## delete_repo_runner + +> delete_repo_runner(owner, repo, runner_id) +Delete an repo-level runner + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**runner_id** | **String** | id of the runner | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## delete_repo_secret > delete_repo_secret(owner, repo, secretname) @@ -321,7 +596,7 @@ Delete a repo-level variable Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**owner** | **String** | name of the owner | [required] | +**owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repository | [required] | **variablename** | **String** | name of the variable | [required] | @@ -341,6 +616,66 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## download_actions_run_job_logs + +> download_actions_run_job_logs(owner, repo, job_id) +Downloads the job logs for a workflow run + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repository | [required] | +**job_id** | **i32** | id of the job | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## download_artifact + +> download_artifact(owner, repo, artifact_id) +Downloads a specific artifact for a workflow run redirects to blob url + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repository | [required] | +**artifact_id** | **String** | id of the artifact | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## generate_repo > models::Repository generate_repo(template_owner, template_repo, body) @@ -351,7 +686,7 @@ Create a repository using a template Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**template_owner** | **String** | name of the template repository owner | [required] | +**template_owner** | **String** | owner of the template repository | [required] | **template_repo** | **String** | name of the template repository | [required] | **body** | Option<[**GenerateRepoOption**](GenerateRepoOption.md)> | | | @@ -401,6 +736,97 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## get_artifact + +> models::ActionArtifact get_artifact(owner, repo, artifact_id) +Gets a specific artifact for a workflow run + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repository | [required] | +**artifact_id** | **String** | id of the artifact | [required] | + +### Return type + +[**models::ActionArtifact**](ActionArtifact.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## get_artifacts + +> models::ActionArtifactsResponse get_artifacts(owner, repo, name) +Lists all artifacts for a repository + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repository | [required] | +**name** | Option<**String**> | name of the artifact | | + +### Return type + +[**models::ActionArtifactsResponse**](ActionArtifactsResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## get_artifacts_of_run + +> models::ActionArtifactsResponse get_artifacts_of_run(owner, repo, run, name) +Lists all artifacts for a repository run + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repository | [required] | +**run** | **i32** | runid of the workflow run | [required] | +**name** | Option<**String**> | name of the artifact | | + +### Return type + +[**models::ActionArtifactsResponse**](ActionArtifactsResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## get_blob > models::GitBlobResponse get_blob(owner, repo, sha) @@ -431,6 +857,65 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## get_repo_runner + +> get_repo_runner(owner, repo, runner_id) +Get an repo-level runner + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**runner_id** | **String** | id of the runner | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## get_repo_runners + +> get_repo_runners(owner, repo) +Get repo-level runners + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## get_repo_variable > models::ActionVariable get_repo_variable(owner, repo, variablename) @@ -441,7 +926,7 @@ Get a repo-level variable Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**owner** | **String** | name of the owner | [required] | +**owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repository | [required] | **variablename** | **String** | name of the variable | [required] | @@ -471,7 +956,7 @@ Get repo-level variables list Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**owner** | **String** | name of the owner | [required] | +**owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repository | [required] | **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | @@ -525,6 +1010,133 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## get_workflow_job + +> models::ActionWorkflowJob get_workflow_job(owner, repo, job_id) +Gets a specific workflow job for a workflow run + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repository | [required] | +**job_id** | **String** | id of the job | [required] | + +### Return type + +[**models::ActionWorkflowJob**](ActionWorkflowJob.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## get_workflow_run + +> models::ActionWorkflowRun get_workflow_run(owner, repo, run) +Gets a specific workflow run + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repository | [required] | +**run** | **String** | id of the run | [required] | + +### Return type + +[**models::ActionWorkflowRun**](ActionWorkflowRun.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## get_workflow_runs + +> models::ActionWorkflowRunsResponse get_workflow_runs(owner, repo, event, branch, status, actor, head_sha, page, limit) +Lists all runs for a repository run + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repository | [required] | +**event** | Option<**String**> | workflow event name | | +**branch** | Option<**String**> | workflow branch | | +**status** | Option<**String**> | workflow status (pending, queued, in_progress, failure, success, skipped) | | +**actor** | Option<**String**> | triggered by user | | +**head_sha** | Option<**String**> | triggering sha of the workflow run | | +**page** | Option<**i32**> | page number of results to return (1-based) | | +**limit** | Option<**i32**> | page size of results | | + +### Return type + +[**models::ActionWorkflowRunsResponse**](ActionWorkflowRunsResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## list_action_tasks + +> models::ActionTaskResponse list_action_tasks(owner, repo, page, limit) +List a repository's action tasks + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**page** | Option<**i32**> | page number of results to return (1-based) | | +**limit** | Option<**i32**> | page size of results, default maximum page size is 50 | | + +### Return type + +[**models::ActionTaskResponse**](ActionTaskResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## list_forks > Vec list_forks(owner, repo, page, limit) @@ -556,6 +1168,71 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## list_workflow_jobs + +> models::ActionWorkflowJobsResponse list_workflow_jobs(owner, repo, status, page, limit) +Lists all jobs for a repository + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repository | [required] | +**status** | Option<**String**> | workflow status (pending, queued, in_progress, failure, success, skipped) | | +**page** | Option<**i32**> | page number of results to return (1-based) | | +**limit** | Option<**i32**> | page size of results | | + +### Return type + +[**models::ActionWorkflowJobsResponse**](ActionWorkflowJobsResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## list_workflow_run_jobs + +> models::ActionWorkflowJobsResponse list_workflow_run_jobs(owner, repo, run, status, page, limit) +Lists all jobs for a workflow run + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repository | [required] | +**run** | **i32** | runid of the workflow run | [required] | +**status** | Option<**String**> | workflow status (pending, queued, in_progress, failure, success, skipped) | | +**page** | Option<**i32**> | page number of results to return (1-based) | | +**limit** | Option<**i32**> | page size of results | | + +### Return type + +[**models::ActionWorkflowJobsResponse**](ActionWorkflowJobsResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## reject_repo_transfer > models::Repository reject_repo_transfer(owner, repo) @@ -588,7 +1265,7 @@ Name | Type | Description | Required | Notes ## repo_add_collaborator > repo_add_collaborator(owner, repo, collaborator, body) -Add a collaborator to a repository +Add or Update a collaborator to a repository ### Parameters @@ -597,7 +1274,7 @@ Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repo | [required] | -**collaborator** | **String** | username of the collaborator to add | [required] | +**collaborator** | **String** | username of the user to add or update as a collaborator | [required] | **body** | Option<[**AddCollaboratorOption**](AddCollaboratorOption.md)> | | | ### Return type @@ -718,7 +1395,7 @@ Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repo | [required] | -**body** | [**UpdateFileOptions**](UpdateFileOptions.md) | | [required] | +**body** | [**ApplyDiffPatchFileOptions**](ApplyDiffPatchFileOptions.md) | | [required] | ### Return type @@ -808,7 +1485,7 @@ Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repo | [required] | -**collaborator** | **String** | username of the collaborator | [required] | +**collaborator** | **String** | username of the user to check for being a collaborator | [required] | ### Return type @@ -1191,6 +1868,35 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## repo_create_runner_registration_token + +> repo_create_runner_registration_token(owner, repo) +Get a repository's actions runner registration token + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## repo_create_status > models::CommitStatus repo_create_status(owner, repo, sha, body) @@ -1252,6 +1958,36 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## repo_create_tag_protection + +> models::TagProtection repo_create_tag_protection(owner, repo, body) +Create a tag protections for a repository + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**body** | Option<[**CreateTagProtectionOption**](CreateTagProtectionOption.md)> | | | + +### Return type + +[**models::TagProtection**](TagProtection.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## repo_create_wiki_page > models::WikiPage repo_create_wiki_page(owner, repo, body) @@ -1764,6 +2500,36 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## repo_delete_tag_protection + +> repo_delete_tag_protection(owner, repo, id) +Delete a specific tag protection for the repository + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**id** | **i32** | id of protected tag | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## repo_delete_team > repo_delete_team(owner, repo, team) @@ -2166,6 +2932,37 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## repo_edit_tag_protection + +> models::TagProtection repo_edit_tag_protection(owner, repo, id, body) +Edit a tag protections for a repository. Only fields that are set will be changed + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**id** | **i32** | id of protected tag | [required] | +**body** | Option<[**EditTagProtectionOption**](EditTagProtectionOption.md)> | | | + +### Return type + +[**models::TagProtection**](TagProtection.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## repo_edit_wiki_page > models::WikiPage repo_edit_wiki_page(owner, repo, page_name, body) @@ -2228,7 +3025,7 @@ Name | Type | Description | Required | Notes ## repo_get_all_commits -> Vec repo_get_all_commits(owner, repo, sha, path, stat, verification, files, page, limit, not) +> Vec repo_get_all_commits(owner, repo, sha, path, since, until, stat, verification, files, page, limit, not) Get a list of all commits from a repository ### Parameters @@ -2240,6 +3037,8 @@ Name | Type | Description | Required | Notes **repo** | **String** | name of the repo | [required] | **sha** | Option<**String**> | SHA or branch to start listing commits from (usually 'master') | | **path** | Option<**String**> | filepath of a file/dir | | +**since** | Option<**String**> | Only commits after this date will be returned (ISO 8601 format) | | +**until** | Option<**String**> | Only commits before this date will be returned (ISO 8601 format) | | **stat** | Option<**bool**> | include diff stats for every commit (disable for speedup, default 'true') | | **verification** | Option<**bool**> | include verification for every commit (disable for speedup, default 'true') | | **files** | Option<**bool**> | include a list of affected files for every commit (disable for speedup, default 'true') | | @@ -2445,7 +3244,7 @@ Name | Type | Description | Required | Notes ## repo_get_commit_pull_request > models::PullRequest repo_get_commit_pull_request(owner, repo, sha) -Get the pull request of the commit +Get the merged pull request of the commit ### Parameters @@ -2475,7 +3274,9 @@ Name | Type | Description | Required | Notes ## repo_get_contents > models::ContentsResponse repo_get_contents(owner, repo, filepath, r#ref) -Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir +Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir. + +This API follows GitHub's design, and it is not easy to use. Recommend users to use the \"contents-ext\" API instead. ### Parameters @@ -2485,7 +3286,7 @@ Name | Type | Description | Required | Notes **owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repo | [required] | **filepath** | **String** | path of the dir, file, symlink or submodule in the repo | [required] | -**r#ref** | Option<**String**> | The name of the commit/branch/tag. Default the repository’s default branch (usually master) | | +**r#ref** | Option<**String**> | The name of the commit/branch/tag. Default to the repository’s default branch. | | ### Return type @@ -2503,10 +3304,12 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## repo_get_contents_list +## repo_get_contents_ext -> Vec repo_get_contents_list(owner, repo, r#ref) -Gets the metadata of all the entries of the root dir +> models::ContentsExtResponse repo_get_contents_ext(owner, repo, filepath, r#ref, includes) +The extended \"contents\" API, to get file metadata and/or content, or list a directory. + +It guarantees that only one of the response fields is set if the request succeeds. Users can pass \"includes=file_content\" or \"includes=lfs_metadata\" to retrieve more fields. \"includes=file_content\" only works for single file, if you need to retrieve file contents in batch, use \"file-contents\" API after listing the directory. ### Parameters @@ -2515,7 +3318,41 @@ Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repo | [required] | -**r#ref** | Option<**String**> | The name of the commit/branch/tag. Default the repository’s default branch (usually master) | | +**filepath** | **String** | path of the dir, file, symlink or submodule in the repo. Swagger requires path parameter to be \"required\", you can leave it empty or pass a single dot (\".\") to get the root directory. | [required] | +**r#ref** | Option<**String**> | the name of the commit/branch/tag, default to the repository’s default branch. | | +**includes** | Option<**String**> | By default this API's response only contains file's metadata. Use comma-separated \"includes\" options to retrieve more fields. Option \"file_content\" will try to retrieve the file content, \"lfs_metadata\" will try to retrieve LFS metadata, \"commit_metadata\" will try to retrieve commit metadata, and \"commit_message\" will try to retrieve commit message. | | + +### Return type + +[**models::ContentsExtResponse**](ContentsExtResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## repo_get_contents_list + +> Vec repo_get_contents_list(owner, repo, r#ref) +Gets the metadata of all the entries of the root dir. + +This API follows GitHub's design, and it is not easy to use. Recommend users to use our \"contents-ext\" API instead. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**r#ref** | Option<**String**> | The name of the commit/branch/tag. Default to the repository’s default branch. | | ### Return type @@ -2546,7 +3383,7 @@ Name | Type | Description | Required | Notes **owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repo | [required] | **filepath** | **String** | filepath of file to get | [required] | -**r#ref** | Option<**String**> | The name of the commit/branch/tag. Default the repository’s default branch (usually master) | | +**r#ref** | Option<**String**> | The name of the commit/branch/tag. Default to the repository’s default branch. | | ### Return type @@ -2564,6 +3401,72 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## repo_get_file_contents + +> Vec repo_get_file_contents(owner, repo, body, r#ref) +Get the metadata and contents of requested files + +See the POST method. This GET method supports using JSON encoded request body in query parameter. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**body** | **String** | The JSON encoded body (see the POST request): {\"files\": [\"filename1\", \"filename2\"]} | [required] | +**r#ref** | Option<**String**> | The name of the commit/branch/tag. Default to the repository’s default branch. | | + +### Return type + +[**Vec**](ContentsResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## repo_get_file_contents_post + +> Vec repo_get_file_contents_post(owner, repo, body, r#ref) +Get the metadata and contents of requested files + +Uses automatic pagination based on default page size and max response size and returns the maximum allowed number of files. Files which could not be retrieved are null. Files which are too large are being returned with `encoding == null`, `content == null` and `size > 0`, they can be requested separately by using the `download_url`. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**body** | [**GetFilesOptions**](GetFilesOptions.md) | | [required] | +**r#ref** | Option<**String**> | The name of the commit/branch/tag. Default to the repository’s default branch. | | + +### Return type + +[**Vec**](ContentsResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json, text/plain +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## repo_get_git_hook > models::GitHook repo_get_git_hook(owner, repo, id) @@ -2770,6 +3673,35 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## repo_get_licenses + +> Vec repo_get_licenses(owner, repo) +Get repo licenses + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | + +### Return type + +**Vec** + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## repo_get_note > models::Note repo_get_note(owner, repo, sha, verification, files) @@ -3025,7 +3957,7 @@ Name | Type | Description | Required | Notes ## repo_get_raw_file -> repo_get_raw_file(owner, repo, filepath, r#ref) +> std::path::PathBuf repo_get_raw_file(owner, repo, filepath, r#ref) Get a file from a repository ### Parameters @@ -3035,12 +3967,12 @@ Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repo | [required] | -**filepath** | **String** | filepath of the file to get | [required] | -**r#ref** | Option<**String**> | The name of the commit/branch/tag. Default the repository’s default branch (usually master) | | +**filepath** | **String** | path of the file to get, it should be \"{ref}/{filepath}\". If there is no ref could be inferred, it will be treated as the default branch | [required] | +**r#ref** | Option<**String**> | The name of the commit/branch/tag. Default to the repository’s default branch | | ### Return type - (empty response body) +[**std::path::PathBuf**](std::path::PathBuf.md) ### Authorization @@ -3049,14 +3981,14 @@ Name | Type | Description | Required | Notes ### HTTP request headers - **Content-Type**: Not defined -- **Accept**: Not defined +- **Accept**: application/octet-stream [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) ## repo_get_raw_file_or_lfs -> repo_get_raw_file_or_lfs(owner, repo, filepath, r#ref) +> std::path::PathBuf repo_get_raw_file_or_lfs(owner, repo, filepath, r#ref) Get a file or it's LFS object from a repository ### Parameters @@ -3066,12 +3998,12 @@ Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repo | [required] | -**filepath** | **String** | filepath of the file to get | [required] | -**r#ref** | Option<**String**> | The name of the commit/branch/tag. Default the repository’s default branch (usually master) | | +**filepath** | **String** | path of the file to get, it should be \"{ref}/{filepath}\". If there is no ref could be inferred, it will be treated as the default branch | [required] | +**r#ref** | Option<**String**> | The name of the commit/branch/tag. Default to the repository’s default branch | | ### Return type - (empty response body) +[**std::path::PathBuf**](std::path::PathBuf.md) ### Authorization @@ -3080,7 +4012,7 @@ Name | Type | Description | Required | Notes ### HTTP request headers - **Content-Type**: Not defined -- **Accept**: Not defined +- **Accept**: application/octet-stream [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -3188,7 +4120,7 @@ Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repo | [required] | -**collaborator** | **String** | username of the collaborator | [required] | +**collaborator** | **String** | username of the collaborator whose permissions are to be obtained | [required] | ### Return type @@ -3327,6 +4259,36 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## repo_get_tag_protection + +> models::TagProtection repo_get_tag_protection(owner, repo, id) +Get a specific tag protection for the repository + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**id** | **i32** | id of the tag protect to get | [required] | + +### Return type + +[**models::TagProtection**](TagProtection.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## repo_get_wiki_page > models::WikiPage repo_get_wiki_page(owner, repo, page_name) @@ -3429,7 +4391,7 @@ List an repo's actions secrets Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**owner** | **String** | owner of the repository | [required] | +**owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repository | [required] | **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | @@ -3785,7 +4747,7 @@ Name | Type | Description | Required | Notes ## repo_list_pull_requests -> Vec repo_list_pull_requests(owner, repo, state, sort, milestone, labels, page, limit) +> Vec repo_list_pull_requests(owner, repo, base_branch, state, sort, milestone, labels, poster, page, limit) List a repo's pull requests ### Parameters @@ -3794,13 +4756,15 @@ List a repo's pull requests Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **owner** | **String** | owner of the repo | [required] | -**repo** | **String** | name of the repo | [required] | -**state** | Option<**String**> | State of pull request: open or closed (optional) | | +**repo** | **String** | Name of the repo | [required] | +**base_branch** | Option<**String**> | Filter by target base branch of the pull request | | +**state** | Option<**String**> | State of pull request | |[default to open] **sort** | Option<**String**> | Type of sort | | **milestone** | Option<**i64**> | ID of the milestone | | -**labels** | Option<[**Vec**](i64.md)> | Label IDs | | -**page** | Option<**i32**> | page number of results to return (1-based) | | -**limit** | Option<**i32**> | page size of results | | +**labels** | Option<[**Vec**](I64.md)> | Label IDs | | +**poster** | Option<**String**> | Filter by pull request author | | +**page** | Option<**i32**> | Page number of results to return (1-based) | |[default to 1] +**limit** | Option<**i32**> | Page size of results | | ### Return type @@ -4074,6 +5038,35 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## repo_list_tag_protection + +> Vec repo_list_tag_protection(owner, repo) +List tag protections for a repository + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | + +### Return type + +[**Vec**](TagProtection.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## repo_list_tags > Vec repo_list_tags(owner, repo, page, limit) @@ -4196,6 +5189,36 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## repo_merge_upstream + +> models::MergeUpstreamResponse repo_merge_upstream(owner, repo, body) +Merge a branch from upstream + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**body** | Option<[**MergeUpstreamRequest**](MergeUpstreamRequest.md)> | | | + +### Return type + +[**models::MergeUpstreamResponse**](MergeUpstreamResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json, text/plain +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## repo_migrate > models::Repository repo_migrate(body) @@ -4341,6 +5364,37 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## repo_rename_branch + +> repo_rename_branch(owner, repo, branch, body) +Rename a branch + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**branch** | **String** | name of the branch | [required] | +**body** | Option<[**RenameBranchRepoOption**](RenameBranchRepoOption.md)> | | | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## repo_search > models::SearchResults repo_search(q, topic, include_desc, uid, priority_owner_id, team_id, starred_by, private, is_private, template, archived, mode, exclusive, sort, order, page, limit) @@ -4364,7 +5418,7 @@ Name | Type | Description | Required | Notes **archived** | Option<**bool**> | show only archived, non-archived or all repositories (defaults to all) | | **mode** | Option<**String**> | type of repository to search for. Supported values are \"fork\", \"source\", \"mirror\" and \"collaborative\" | | **exclusive** | Option<**bool**> | if `uid` is given, search only for repos that the user owns | | -**sort** | Option<**String**> | sort repos by attribute. Supported values are \"alpha\", \"created\", \"updated\", \"size\", and \"id\". Default is \"alpha\" | | +**sort** | Option<**String**> | sort repos by attribute. Supported values are \"alpha\", \"created\", \"updated\", \"size\", \"git_size\", \"lfs_size\", \"stars\", \"forks\" and \"id\". Default is \"alpha\" | | **order** | Option<**String**> | sort order, either \"asc\" (ascending) or \"desc\" (descending). Default is \"asc\", ignored if \"sort\" is not specified. | | **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | @@ -4414,6 +5468,35 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## repo_signing_key_ssh + +> String repo_signing_key_ssh(owner, repo) +Get signing-key.pub for given repository + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | + +### Return type + +**String** + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## repo_submit_pull_review > models::PullReview repo_submit_pull_review(owner, repo, index, id, body) @@ -4602,6 +5685,36 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## repo_update_branch_protection_priories + +> repo_update_branch_protection_priories(owner, repo, body) +Update the priorities of branch protections for a repository. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**owner** | **String** | owner of the repo | [required] | +**repo** | **String** | name of the repo | [required] | +**body** | Option<[**UpdateBranchProtectionPriories**](UpdateBranchProtectionPriories.md)> | | | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## repo_update_file > models::FileResponse repo_update_file(owner, repo, filepath, body) @@ -4794,7 +5907,7 @@ Update a repo-level variable Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**owner** | **String** | name of the owner | [required] | +**owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repository | [required] | **variablename** | **String** | name of the variable | [required] | **body** | Option<[**UpdateVariableOption**](UpdateVariableOption.md)> | | | @@ -4914,7 +6027,7 @@ Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **owner** | **String** | owner of the repo | [required] | **repo** | **String** | name of the repo | [required] | -**user** | **String** | username of user | [required] | +**user** | **String** | username of the user whose tracked times are to be listed | [required] | ### Return type diff --git a/crates/gitea-client/docs/SearchResults.md b/crates/gitea-client/docs/SearchResults.md index 4642d2e..8278d40 100644 --- a/crates/gitea-client/docs/SearchResults.md +++ b/crates/gitea-client/docs/SearchResults.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**data** | Option<[**Vec**](Repository.md)> | | [optional] -**ok** | Option<**bool**> | | [optional] +**data** | Option<[**Vec**](Repository.md)> | Data contains the repository search results | [optional] +**ok** | Option<**bool**> | OK indicates if the search was successful | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Secret.md b/crates/gitea-client/docs/Secret.md index b5bcf73..7c8692d 100644 --- a/crates/gitea-client/docs/Secret.md +++ b/crates/gitea-client/docs/Secret.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | Option<**String**> | | [optional] +**description** | Option<**String**> | the secret's description | [optional] **name** | Option<**String**> | the secret's name | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/ServerVersion.md b/crates/gitea-client/docs/ServerVersion.md index 96ba26f..9749b2f 100644 --- a/crates/gitea-client/docs/ServerVersion.md +++ b/crates/gitea-client/docs/ServerVersion.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**version** | Option<**String**> | | [optional] +**version** | Option<**String**> | Version is the server version string | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/StopWatch.md b/crates/gitea-client/docs/StopWatch.md index fb0b10b..f8dfac6 100644 --- a/crates/gitea-client/docs/StopWatch.md +++ b/crates/gitea-client/docs/StopWatch.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created** | Option<**String**> | | [optional] -**duration** | Option<**String**> | | [optional] -**issue_index** | Option<**i64**> | | [optional] -**issue_title** | Option<**String**> | | [optional] -**repo_name** | Option<**String**> | | [optional] -**repo_owner_name** | Option<**String**> | | [optional] -**seconds** | Option<**i64**> | | [optional] +**duration** | Option<**String**> | Duration is a human-readable duration string | [optional] +**issue_index** | Option<**i64**> | IssueIndex is the index number of the associated issue | [optional] +**issue_title** | Option<**String**> | IssueTitle is the title of the associated issue | [optional] +**repo_name** | Option<**String**> | RepoName is the name of the repository | [optional] +**repo_owner_name** | Option<**String**> | RepoOwnerName is the name of the repository owner | [optional] +**seconds** | Option<**i64**> | Seconds is the total elapsed time in seconds | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/Tag.md b/crates/gitea-client/docs/Tag.md index d33b00f..4ada13b 100644 --- a/crates/gitea-client/docs/Tag.md +++ b/crates/gitea-client/docs/Tag.md @@ -5,11 +5,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **commit** | Option<[**models::CommitMeta**](CommitMeta.md)> | | [optional] -**id** | Option<**String**> | | [optional] -**message** | Option<**String**> | | [optional] -**name** | Option<**String**> | | [optional] -**tarball_url** | Option<**String**> | | [optional] -**zipball_url** | Option<**String**> | | [optional] +**id** | Option<**String**> | The ID (SHA) of the tag | [optional] +**message** | Option<**String**> | The message associated with the tag | [optional] +**name** | Option<**String**> | The name of the tag | [optional] +**tarball_url** | Option<**String**> | The URL to download the tarball archive | [optional] +**zipball_url** | Option<**String**> | The URL to download the zipball archive | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/TagProtection.md b/crates/gitea-client/docs/TagProtection.md new file mode 100644 index 0000000..bab0473 --- /dev/null +++ b/crates/gitea-client/docs/TagProtection.md @@ -0,0 +1,16 @@ +# TagProtection + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**created_at** | Option<**String**> | | [optional] +**id** | Option<**i64**> | The unique identifier of the tag protection | [optional] +**name_pattern** | Option<**String**> | The pattern to match tag names for protection | [optional] +**updated_at** | Option<**String**> | | [optional] +**whitelist_teams** | Option<**Vec**> | List of team names allowed to create/delete protected tags | [optional] +**whitelist_usernames** | Option<**Vec**> | List of usernames allowed to create/delete protected tags | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/Team.md b/crates/gitea-client/docs/Team.md index 19455ae..05ce4cd 100644 --- a/crates/gitea-client/docs/Team.md +++ b/crates/gitea-client/docs/Team.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**can_create_org_repo** | Option<**bool**> | | [optional] -**description** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**includes_all_repositories** | Option<**bool**> | | [optional] -**name** | Option<**String**> | | [optional] +**can_create_org_repo** | Option<**bool**> | Whether the team can create repositories in the organization | [optional] +**description** | Option<**String**> | The description of the team | [optional] +**id** | Option<**i64**> | The unique identifier of the team | [optional] +**includes_all_repositories** | Option<**bool**> | Whether the team has access to all repositories in the organization | [optional] +**name** | Option<**String**> | The name of the team | [optional] **organization** | Option<[**models::Organization**](Organization.md)> | | [optional] -**permission** | Option<**String**> | | [optional] +**permission** | Option<**Permission**> | (enum: none, read, write, admin, owner) | [optional] **units** | Option<**Vec**> | | [optional] **units_map** | Option<**std::collections::HashMap**> | | [optional] diff --git a/crates/gitea-client/docs/TimelineComment.md b/crates/gitea-client/docs/TimelineComment.md index 908d4bc..ee60cdb 100644 --- a/crates/gitea-client/docs/TimelineComment.md +++ b/crates/gitea-client/docs/TimelineComment.md @@ -6,12 +6,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **assignee** | Option<[**models::User**](User.md)> | | [optional] **assignee_team** | Option<[**models::Team**](Team.md)> | | [optional] -**body** | Option<**String**> | | [optional] +**body** | Option<**String**> | Body contains the timeline event content | [optional] **created_at** | Option<**String**> | | [optional] **dependent_issue** | Option<[**models::Issue**](Issue.md)> | | [optional] -**html_url** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**issue_url** | Option<**String**> | | [optional] +**html_url** | Option<**String**> | HTMLURL is the web URL for viewing the comment | [optional] +**id** | Option<**i64**> | ID is the unique identifier for the timeline comment | [optional] +**issue_url** | Option<**String**> | IssueURL is the API URL for the issue | [optional] **label** | Option<[**models::Label**](Label.md)> | | [optional] **milestone** | Option<[**models::Milestone**](Milestone.md)> | | [optional] **new_ref** | Option<**String**> | | [optional] @@ -21,7 +21,7 @@ Name | Type | Description | Notes **old_ref** | Option<**String**> | | [optional] **old_title** | Option<**String**> | | [optional] **project_id** | Option<**i64**> | | [optional] -**pull_request_url** | Option<**String**> | | [optional] +**pull_request_url** | Option<**String**> | PRURL is the API URL for the pull request (if applicable) | [optional] **ref_action** | Option<**String**> | | [optional] **ref_comment** | Option<[**models::Comment**](Comment.md)> | | [optional] **ref_commit_sha** | Option<**String**> | commit SHA where issue/PR was referenced | [optional] @@ -30,7 +30,7 @@ Name | Type | Description | Notes **resolve_doer** | Option<[**models::User**](User.md)> | | [optional] **review_id** | Option<**i64**> | | [optional] **tracked_time** | Option<[**models::TrackedTime**](TrackedTime.md)> | | [optional] -**r#type** | Option<**String**> | | [optional] +**r#type** | Option<**String**> | Type indicates the type of timeline event | [optional] **updated_at** | Option<**String**> | | [optional] **user** | Option<[**models::User**](User.md)> | | [optional] diff --git a/crates/gitea-client/docs/TopicName.md b/crates/gitea-client/docs/TopicName.md index 8a07731..4d1ff7f 100644 --- a/crates/gitea-client/docs/TopicName.md +++ b/crates/gitea-client/docs/TopicName.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**topics** | Option<**Vec**> | | [optional] +**topics** | Option<**Vec**> | List of topic names | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/TopicResponse.md b/crates/gitea-client/docs/TopicResponse.md index e018c94..d2c04a8 100644 --- a/crates/gitea-client/docs/TopicResponse.md +++ b/crates/gitea-client/docs/TopicResponse.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**created** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**repo_count** | Option<**i64**> | | [optional] -**topic_name** | Option<**String**> | | [optional] -**updated** | Option<**String**> | | [optional] +**created** | Option<**String**> | The date and time when the topic was created | [optional] +**id** | Option<**i64**> | The unique identifier of the topic | [optional] +**repo_count** | Option<**i64**> | The number of repositories using this topic | [optional] +**topic_name** | Option<**String**> | The name of the topic | [optional] +**updated** | Option<**String**> | The date and time when the topic was last updated | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/TrackedTime.md b/crates/gitea-client/docs/TrackedTime.md index 91f638d..2323651 100644 --- a/crates/gitea-client/docs/TrackedTime.md +++ b/crates/gitea-client/docs/TrackedTime.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] +**id** | Option<**i64**> | ID is the unique identifier for the tracked time entry | [optional] **issue** | Option<[**models::Issue**](Issue.md)> | | [optional] **issue_id** | Option<**i64**> | deprecated (only for backwards compatibility) | [optional] **time** | Option<**i64**> | Time in seconds | [optional] **user_id** | Option<**i64**> | deprecated (only for backwards compatibility) | [optional] -**user_name** | Option<**String**> | | [optional] +**user_name** | Option<**String**> | username of the user | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/UpdateBranchProtectionPriories.md b/crates/gitea-client/docs/UpdateBranchProtectionPriories.md new file mode 100644 index 0000000..a0480f3 --- /dev/null +++ b/crates/gitea-client/docs/UpdateBranchProtectionPriories.md @@ -0,0 +1,11 @@ +# UpdateBranchProtectionPriories + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | Option<**Vec**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/crates/gitea-client/docs/UpdateFileOptions.md b/crates/gitea-client/docs/UpdateFileOptions.md index 9d5435b..f861d13 100644 --- a/crates/gitea-client/docs/UpdateFileOptions.md +++ b/crates/gitea-client/docs/UpdateFileOptions.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **from_path** | Option<**String**> | from_path (optional) is the path of the original file which will be moved/renamed to the path in the URL | [optional] **message** | Option<**String**> | message (optional) for the commit of this file. if not supplied, a default message will be used | [optional] **new_branch** | Option<**String**> | new_branch (optional) will make a new branch from `branch` before creating the file | [optional] -**sha** | **String** | sha is the SHA for the file that already exists | +**sha** | **String** | the blob ID (SHA) for the file that already exists, it is required for changing existing files | **signoff** | Option<**bool**> | Add a Signed-off-by trailer by the committer at the end of the commit log message. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/UpdateVariableOption.md b/crates/gitea-client/docs/UpdateVariableOption.md index 4f12f4b..4d7c7e8 100644 --- a/crates/gitea-client/docs/UpdateVariableOption.md +++ b/crates/gitea-client/docs/UpdateVariableOption.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**description** | Option<**String**> | Description of the variable to update | [optional] **name** | Option<**String**> | New name for the variable. If the field is empty, the variable name won't be updated. | [optional] **value** | **String** | Value of the variable to update | diff --git a/crates/gitea-client/docs/User.md b/crates/gitea-client/docs/User.md index 95136d1..1fd303a 100644 --- a/crates/gitea-client/docs/User.md +++ b/crates/gitea-client/docs/User.md @@ -18,8 +18,8 @@ Name | Type | Description | Notes **language** | Option<**String**> | User locale | [optional] **last_login** | Option<**String**> | | [optional] **location** | Option<**String**> | the user's location | [optional] -**login** | Option<**String**> | the user's username | [optional] -**login_name** | Option<**String**> | the user's authentication sign-in name. | [optional][default to empty] +**login** | Option<**String**> | login of the user, same as `username` | [optional] +**login_name** | Option<**String**> | identifier of the user, provided by the external authenticator (if configured) | [optional][default to empty] **prohibit_login** | Option<**bool**> | Is user login prohibited | [optional] **restricted** | Option<**bool**> | Is user restricted | [optional] **source_id** | Option<**i64**> | The ID of the user's Authentication Source | [optional] diff --git a/crates/gitea-client/docs/UserApi.md b/crates/gitea-client/docs/UserApi.md index 7acba13..d543a80 100644 --- a/crates/gitea-client/docs/UserApi.md +++ b/crates/gitea-client/docs/UserApi.md @@ -6,11 +6,16 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**create_current_user_repo**](UserApi.md#create_current_user_repo) | **POST** /user/repos | Create a repository [**create_user_variable**](UserApi.md#create_user_variable) | **POST** /user/actions/variables/{variablename} | Create a user-level variable +[**delete_user_runner**](UserApi.md#delete_user_runner) | **DELETE** /user/actions/runners/{runner_id} | Delete an user-level runner [**delete_user_secret**](UserApi.md#delete_user_secret) | **DELETE** /user/actions/secrets/{secretname} | Delete a secret in a user scope [**delete_user_variable**](UserApi.md#delete_user_variable) | **DELETE** /user/actions/variables/{variablename} | Delete a user-level variable which is created by current doer +[**get_user_runner**](UserApi.md#get_user_runner) | **GET** /user/actions/runners/{runner_id} | Get an user-level runner +[**get_user_runners**](UserApi.md#get_user_runners) | **GET** /user/actions/runners | Get user-level runners [**get_user_settings**](UserApi.md#get_user_settings) | **GET** /user/settings | Get user settings [**get_user_variable**](UserApi.md#get_user_variable) | **GET** /user/actions/variables/{variablename} | Get a user-level variable which is created by current doer [**get_user_variables_list**](UserApi.md#get_user_variables_list) | **GET** /user/actions/variables | Get the user-level list of variables which is created by current doer +[**get_user_workflow_jobs**](UserApi.md#get_user_workflow_jobs) | **GET** /user/actions/jobs | Get workflow jobs +[**get_user_workflow_runs**](UserApi.md#get_user_workflow_runs) | **GET** /user/actions/runs | Get workflow runs [**get_verification_token**](UserApi.md#get_verification_token) | **GET** /user/gpg_key_token | Get a Token to verify [**update_user_secret**](UserApi.md#update_user_secret) | **PUT** /user/actions/secrets/{secretname} | Create or Update a secret value in a user scope [**update_user_settings**](UserApi.md#update_user_settings) | **PATCH** /user/settings | Update user settings @@ -21,6 +26,7 @@ Method | HTTP request | Description [**user_check_user_block**](UserApi.md#user_check_user_block) | **GET** /user/blocks/{username} | Check if a user is blocked by the authenticated user [**user_create_hook**](UserApi.md#user_create_hook) | **POST** /user/hooks | Create a hook [**user_create_o_auth2_application**](UserApi.md#user_create_o_auth2_application) | **POST** /user/applications/oauth2 | creates a new OAuth2 application +[**user_create_runner_registration_token**](UserApi.md#user_create_runner_registration_token) | **POST** /user/actions/runners/registration-token | Get an user's actions runner registration token [**user_create_token**](UserApi.md#user_create_token) | **POST** /users/{username}/tokens | Create an access token [**user_current_check_following**](UserApi.md#user_current_check_following) | **GET** /user/following/{username} | Check whether a user is followed by the authenticated user [**user_current_check_starring**](UserApi.md#user_current_check_starring) | **GET** /user/starred/{owner}/{repo} | Whether the authenticated is starring the repo @@ -134,6 +140,34 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## delete_user_runner + +> delete_user_runner(runner_id) +Delete an user-level runner + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**runner_id** | **String** | id of the runner | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## delete_user_secret > delete_user_secret(secretname) @@ -190,6 +224,59 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## get_user_runner + +> get_user_runner(runner_id) +Get an user-level runner + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**runner_id** | **String** | id of the runner | [required] | + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## get_user_runners + +> get_user_runners() +Get user-level runners + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## get_user_settings > Vec get_user_settings() @@ -272,6 +359,70 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## get_user_workflow_jobs + +> models::ActionWorkflowJobsResponse get_user_workflow_jobs(status, page, limit) +Get workflow jobs + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**status** | Option<**String**> | workflow status (pending, queued, in_progress, failure, success, skipped) | | +**page** | Option<**i32**> | page number of results to return (1-based) | | +**limit** | Option<**i32**> | page size of results | | + +### Return type + +[**models::ActionWorkflowJobsResponse**](ActionWorkflowJobsResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## get_user_workflow_runs + +> models::ActionWorkflowRunsResponse get_user_workflow_runs(event, branch, status, actor, head_sha, page, limit) +Get workflow runs + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**event** | Option<**String**> | workflow event name | | +**branch** | Option<**String**> | workflow branch | | +**status** | Option<**String**> | workflow status (pending, queued, in_progress, failure, success, skipped) | | +**actor** | Option<**String**> | triggered by user | | +**head_sha** | Option<**String**> | triggering sha of the workflow run | | +**page** | Option<**i32**> | page number of results to return (1-based) | | +**limit** | Option<**i32**> | page size of results | | + +### Return type + +[**models::ActionWorkflowRunsResponse**](ActionWorkflowRunsResponse.md) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## get_verification_token > String get_verification_token() @@ -421,7 +572,7 @@ Block a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | user to block | [required] | +**username** | **String** | username of the user to block | [required] | **note** | Option<**String**> | optional note for the block | | ### Return type @@ -450,8 +601,8 @@ Check if one user is following another user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of following user | [required] | -**target** | **String** | username of followed user | [required] | +**username** | **String** | username of the following user | [required] | +**target** | **String** | username of the followed user | [required] | ### Return type @@ -479,7 +630,7 @@ Check if a user is blocked by the authenticated user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | user to check | [required] | +**username** | **String** | username of the user to check | [required] | ### Return type @@ -553,6 +704,31 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## user_create_runner_registration_token + +> user_create_runner_registration_token() +Get an user's actions runner registration token + +### Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +[TOTPHeader](../README.md#TOTPHeader), [AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken), [SudoHeader](../README.md#SudoHeader), [BasicAuth](../README.md#BasicAuth), [AccessToken](../README.md#AccessToken), [SudoParam](../README.md#SudoParam), [Token](../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## user_create_token > models::AccessToken user_create_token(username, body) @@ -563,7 +739,7 @@ Create an access token Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose token is to be created | [required] | **body** | Option<[**CreateAccessTokenOption**](CreateAccessTokenOption.md)> | | | ### Return type @@ -592,7 +768,7 @@ Check whether a user is followed by the authenticated user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of followed user | [required] | +**username** | **String** | username of the user to check for authenticated followers | [required] | ### Return type @@ -649,7 +825,7 @@ Unfollow a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user to unfollow | [required] | +**username** | **String** | username of the user to unfollow | [required] | ### Return type @@ -1078,7 +1254,7 @@ Follow a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user to follow | [required] | +**username** | **String** | username of the user to follow | [required] | ### Return type @@ -1166,7 +1342,7 @@ delete an access token Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose token is to be deleted | [required] | **token** | **String** | token to be deleted, identified by ID and if not available by name | [required] | ### Return type @@ -1333,7 +1509,7 @@ Get a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user to get | [required] | +**username** | **String** | username of the user whose data is to be listed | [required] | ### Return type @@ -1386,7 +1562,7 @@ Get a user's heatmap Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user to get | [required] | +**username** | **String** | username of the user whose heatmap is to be obtained | [required] | ### Return type @@ -1553,7 +1729,7 @@ List the authenticated user's access tokens Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of to user whose access tokens are to be listed | [required] | **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | @@ -1583,7 +1759,7 @@ List a user's activity feeds Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose activity feeds are to be listed | [required] | **only_performed_by** | Option<**bool**> | if true, only show actions performed by the requested user | | **date** | Option<**String**> | the date of the activities to be found | | **page** | Option<**i32**> | page number of results to return (1-based) | | @@ -1669,7 +1845,7 @@ List the given user's followers Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose followers are to be listed | [required] | **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | @@ -1699,7 +1875,7 @@ List the users that the given user is following Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose followed users are to be listed | [required] | **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | @@ -1729,7 +1905,7 @@ List the given user's GPG keys Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose GPG key list is to be obtained | [required] | **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | @@ -1788,7 +1964,7 @@ List the given user's public keys Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose public keys are to be listed | [required] | **fingerprint** | Option<**String**> | fingerprint of the key | | **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | @@ -1819,7 +1995,7 @@ List the repos owned by the given user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose owned repos are to be listed | [required] | **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | @@ -1849,7 +2025,7 @@ The repos that the given user has starred Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of user | [required] | +**username** | **String** | username of the user whose starred repos are to be listed | [required] | **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | @@ -1879,7 +2055,7 @@ List the repositories watched by a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | username of the user | [required] | +**username** | **String** | username of the user whose watched repos are to be listed | [required] | **page** | Option<**i32**> | page number of results to return (1-based) | | **limit** | Option<**i32**> | page size of results | | @@ -1969,7 +2145,7 @@ Unblock a user Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**username** | **String** | user to unblock | [required] | +**username** | **String** | username of the user to unblock | [required] | ### Return type diff --git a/crates/gitea-client/docs/WatchInfo.md b/crates/gitea-client/docs/WatchInfo.md index 511197e..a757642 100644 --- a/crates/gitea-client/docs/WatchInfo.md +++ b/crates/gitea-client/docs/WatchInfo.md @@ -4,12 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**created_at** | Option<**String**> | | [optional] -**ignored** | Option<**bool**> | | [optional] -**reason** | Option<[**serde_json::Value**](.md)> | | [optional] -**repository_url** | Option<**String**> | | [optional] -**subscribed** | Option<**bool**> | | [optional] -**url** | Option<**String**> | | [optional] +**created_at** | Option<**String**> | The timestamp when the watch status was created | [optional] +**ignored** | Option<**bool**> | Whether notifications for the repository are ignored | [optional] +**reason** | Option<**serde_json::Value**> | The reason for the current watch status | [optional] +**repository_url** | Option<**String**> | The URL of the repository being watched | [optional] +**subscribed** | Option<**bool**> | Whether the repository is being watched for notifications | [optional] +**url** | Option<**String**> | The URL for managing the watch status | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/WikiCommit.md b/crates/gitea-client/docs/WikiCommit.md index ca978b8..90915a5 100644 --- a/crates/gitea-client/docs/WikiCommit.md +++ b/crates/gitea-client/docs/WikiCommit.md @@ -6,8 +6,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **author** | Option<[**models::CommitUser**](CommitUser.md)> | | [optional] **commiter** | Option<[**models::CommitUser**](CommitUser.md)> | | [optional] -**message** | Option<**String**> | | [optional] -**sha** | Option<**String**> | | [optional] +**message** | Option<**String**> | The commit message | [optional] +**sha** | Option<**String**> | The commit SHA hash | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/WikiCommitList.md b/crates/gitea-client/docs/WikiCommitList.md index 409e2d9..487862a 100644 --- a/crates/gitea-client/docs/WikiCommitList.md +++ b/crates/gitea-client/docs/WikiCommitList.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**commits** | Option<[**Vec**](WikiCommit.md)> | | [optional] -**count** | Option<**i64**> | | [optional] +**commits** | Option<[**Vec**](WikiCommit.md)> | The list of wiki commits | [optional] +**count** | Option<**i64**> | The total count of commits | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/WikiPage.md b/crates/gitea-client/docs/WikiPage.md index 43d3296..84bb5be 100644 --- a/crates/gitea-client/docs/WikiPage.md +++ b/crates/gitea-client/docs/WikiPage.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**commit_count** | Option<**i64**> | | [optional] +**commit_count** | Option<**i64**> | The number of commits that modified this page | [optional] **content_base64** | Option<**String**> | Page content, base64 encoded | [optional] -**footer** | Option<**String**> | | [optional] -**html_url** | Option<**String**> | | [optional] +**footer** | Option<**String**> | The footer content for the wiki page | [optional] +**html_url** | Option<**String**> | The HTML URL to view the wiki page | [optional] **last_commit** | Option<[**models::WikiCommit**](WikiCommit.md)> | | [optional] -**sidebar** | Option<**String**> | | [optional] -**sub_url** | Option<**String**> | | [optional] -**title** | Option<**String**> | | [optional] +**sidebar** | Option<**String**> | The sidebar content for the wiki page | [optional] +**sub_url** | Option<**String**> | The sub URL path for the wiki page | [optional] +**title** | Option<**String**> | The title of the wiki page | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/docs/WikiPageMetaData.md b/crates/gitea-client/docs/WikiPageMetaData.md index 47c5806..5cefa37 100644 --- a/crates/gitea-client/docs/WikiPageMetaData.md +++ b/crates/gitea-client/docs/WikiPageMetaData.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**html_url** | Option<**String**> | | [optional] +**html_url** | Option<**String**> | The HTML URL to view the wiki page | [optional] **last_commit** | Option<[**models::WikiCommit**](WikiCommit.md)> | | [optional] -**sub_url** | Option<**String**> | | [optional] -**title** | Option<**String**> | | [optional] +**sub_url** | Option<**String**> | The sub URL path for the wiki page | [optional] +**title** | Option<**String**> | The title of the wiki page | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/crates/gitea-client/src/apis/activitypub_api.rs b/crates/gitea-client/src/apis/activitypub_api.rs index 490a8c5..f65e5b0 100644 --- a/crates/gitea-client/src/apis/activitypub_api.rs +++ b/crates/gitea-client/src/apis/activitypub_api.rs @@ -3,16 +3,16 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ use reqwest; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; +use super::{Error, configuration, ContentType}; /// struct for typed errors of method [`activitypub_person`] @@ -31,158 +31,165 @@ pub enum ActivitypubPersonInboxError { pub async fn activitypub_person(configuration: &configuration::Configuration, user_id: i32) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_user_id = user_id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/activitypub/user-id/{user_id}", configuration.base_path, user_id=p_path_user_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/activitypub/user-id/{user_id}", local_var_configuration.base_path, user_id=user_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActivityPub`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActivityPub`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn activitypub_person_inbox(configuration: &configuration::Configuration, user_id: i32) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_user_id = user_id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/activitypub/user-id/{user_id}/inbox", configuration.base_path, user_id=p_path_user_id); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/activitypub/user-id/{user_id}/inbox", local_var_configuration.base_path, user_id=user_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } diff --git a/crates/gitea-client/src/apis/admin_api.rs b/crates/gitea-client/src/apis/admin_api.rs index 9c68c66..7e2a993 100644 --- a/crates/gitea-client/src/apis/admin_api.rs +++ b/crates/gitea-client/src/apis/admin_api.rs @@ -3,16 +3,16 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ use reqwest; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; +use super::{Error, configuration, ContentType}; /// struct for typed errors of method [`admin_add_user_badges`] @@ -69,6 +69,13 @@ pub enum AdminCreateRepoError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`admin_create_runner_registration_token`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AdminCreateRunnerRegistrationTokenError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`admin_create_user`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -233,2099 +240,2805 @@ pub enum AdminUnadoptedListError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`delete_admin_runner`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteAdminRunnerError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_admin_runner`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetAdminRunnerError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_admin_runners`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetAdminRunnersError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`list_admin_workflow_jobs`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListAdminWorkflowJobsError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`list_admin_workflow_runs`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListAdminWorkflowRunsError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + pub async fn admin_add_user_badges(configuration: &configuration::Configuration, username: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/users/{username}/badges", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/admin/users/{username}/badges", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_adopt_repository(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/unadopted/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/admin/unadopted/{owner}/{repo}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_create_hook(configuration: &configuration::Configuration, body: models::CreateHookOption) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/hooks", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/admin/hooks", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_create_org(configuration: &configuration::Configuration, username: &str, organization: models::CreateOrgOption) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_body_organization = organization; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/users/{username}/orgs", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/admin/users/{username}/orgs", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&organization); + req_builder = req_builder.json(&p_body_organization); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Organization`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_create_public_key(configuration: &configuration::Configuration, username: &str, key: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_body_key = key; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/users/{username}/keys", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/admin/users/{username}/keys", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&key); + req_builder = req_builder.json(&p_body_key); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PublicKey`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PublicKey`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_create_repo(configuration: &configuration::Configuration, username: &str, repository: models::CreateRepoOption) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_body_repository = repository; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/users/{username}/repos", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/admin/users/{username}/repos", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&repository); + req_builder = req_builder.json(&p_body_repository); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn admin_create_runner_registration_token(configuration: &configuration::Configuration, ) -> Result<(), Error> { + + let uri_str = format!("{}/admin/actions/runners/registration-token", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_create_user(configuration: &configuration::Configuration, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/users", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/admin/users", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::User`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::User`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_cron_list(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/cron", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/admin/cron", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Cron>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Cron>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_cron_run(configuration: &configuration::Configuration, task: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_task = task; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/cron/{task}", configuration.base_path, task=crate::apis::urlencode(p_path_task)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/admin/cron/{task}", local_var_configuration.base_path, task=crate::apis::urlencode(task)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_delete_hook(configuration: &configuration::Configuration, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/hooks/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/admin/hooks/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_delete_unadopted_repository(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/unadopted/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/admin/unadopted/{owner}/{repo}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_delete_user(configuration: &configuration::Configuration, username: &str, purge: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_query_purge = purge; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/users/{username}", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/admin/users/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = purge { - local_var_req_builder = local_var_req_builder.query(&[("purge", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_purge { + req_builder = req_builder.query(&[("purge", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_delete_user_badges(configuration: &configuration::Configuration, username: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/users/{username}/badges", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/admin/users/{username}/badges", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_delete_user_public_key(configuration: &configuration::Configuration, username: &str, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/users/{username}/keys/{id}", configuration.base_path, username=crate::apis::urlencode(p_path_username), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/admin/users/{username}/keys/{id}", local_var_configuration.base_path, username=crate::apis::urlencode(username), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_edit_hook(configuration: &configuration::Configuration, id: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/hooks/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/admin/hooks/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_edit_user(configuration: &configuration::Configuration, username: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/users/{username}", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/admin/users/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::User`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::User`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_get_all_emails(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/emails", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/admin/emails", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Email>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Email>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_get_all_orgs(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/orgs", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/admin/orgs", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Organization>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Organization>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_get_hook(configuration: &configuration::Configuration, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/hooks/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/admin/hooks/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_get_runner_registration_token(configuration: &configuration::Configuration, ) -> Result<(), Error> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/runners/registration-token", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/admin/runners/registration-token", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } -pub async fn admin_list_hooks(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; +pub async fn admin_list_hooks(configuration: &configuration::Configuration, page: Option, limit: Option, r#type: Option<&str>) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; + let p_query_type = r#type; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/hooks", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/admin/hooks", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref param_value) = p_query_type { + req_builder = req_builder.query(&[("type", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Hook>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Hook>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_list_user_badges(configuration: &configuration::Configuration, username: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/users/{username}/badges", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/admin/users/{username}/badges", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Badge>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Badge>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_rename_user(configuration: &configuration::Configuration, username: &str, body: models::RenameUserOption) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/users/{username}/rename", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/admin/users/{username}/rename", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_search_emails(configuration: &configuration::Configuration, q: Option<&str>, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_q = q; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/emails/search", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/admin/emails/search", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = q { - local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_q { + req_builder = req_builder.query(&[("q", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Email>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Email>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_search_users(configuration: &configuration::Configuration, source_id: Option, login_name: Option<&str>, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_source_id = source_id; + let p_query_login_name = login_name; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/users", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/admin/users", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = source_id { - local_var_req_builder = local_var_req_builder.query(&[("source_id", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_source_id { + req_builder = req_builder.query(&[("source_id", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = login_name { - local_var_req_builder = local_var_req_builder.query(&[("login_name", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_login_name { + req_builder = req_builder.query(&[("login_name", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn admin_unadopted_list(configuration: &configuration::Configuration, page: Option, limit: Option, pattern: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; + let p_query_pattern = pattern; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/admin/unadopted", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/admin/unadopted", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = pattern { - local_var_req_builder = local_var_req_builder.query(&[("pattern", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_pattern { + req_builder = req_builder.query(&[("pattern", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<String>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn delete_admin_runner(configuration: &configuration::Configuration, runner_id: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_runner_id = runner_id; + + let uri_str = format!("{}/admin/actions/runners/{runner_id}", configuration.base_path, runner_id=crate::apis::urlencode(p_path_runner_id)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_admin_runner(configuration: &configuration::Configuration, runner_id: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_runner_id = runner_id; + + let uri_str = format!("{}/admin/actions/runners/{runner_id}", configuration.base_path, runner_id=crate::apis::urlencode(p_path_runner_id)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_admin_runners(configuration: &configuration::Configuration, ) -> Result<(), Error> { + + let uri_str = format!("{}/admin/actions/runners", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn list_admin_workflow_jobs(configuration: &configuration::Configuration, status: Option<&str>, page: Option, limit: Option) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_query_status = status; + let p_query_page = page; + let p_query_limit = limit; + + let uri_str = format!("{}/admin/actions/jobs", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_status { + req_builder = req_builder.query(&[("status", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn list_admin_workflow_runs(configuration: &configuration::Configuration, event: Option<&str>, branch: Option<&str>, status: Option<&str>, actor: Option<&str>, head_sha: Option<&str>, page: Option, limit: Option) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_query_event = event; + let p_query_branch = branch; + let p_query_status = status; + let p_query_actor = actor; + let p_query_head_sha = head_sha; + let p_query_page = page; + let p_query_limit = limit; + + let uri_str = format!("{}/admin/actions/runs", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_event { + req_builder = req_builder.query(&[("event", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_branch { + req_builder = req_builder.query(&[("branch", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_status { + req_builder = req_builder.query(&[("status", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_actor { + req_builder = req_builder.query(&[("actor", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_head_sha { + req_builder = req_builder.query(&[("head_sha", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowRunsResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowRunsResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } diff --git a/crates/gitea-client/src/apis/configuration.rs b/crates/gitea-client/src/apis/configuration.rs index 2ab8ba7..2e6199d 100644 --- a/crates/gitea-client/src/apis/configuration.rs +++ b/crates/gitea-client/src/apis/configuration.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -19,7 +19,6 @@ pub struct Configuration { pub oauth_access_token: Option, pub bearer_access_token: Option, pub api_key: Option, - // TODO: take an oauth2 token source, similar to the go one } pub type BasicAuth = (String, Option); @@ -41,13 +40,12 @@ impl Default for Configuration { fn default() -> Self { Configuration { base_path: "/api/v1".to_owned(), - user_agent: Some("OpenAPI-Generator/1.22.1/rust".to_owned()), + user_agent: Some("OpenAPI-Generator/1.25.2/rust".to_owned()), client: reqwest::Client::new(), basic_auth: None, oauth_access_token: None, bearer_access_token: None, api_key: None, - } } } diff --git a/crates/gitea-client/src/apis/issue_api.rs b/crates/gitea-client/src/apis/issue_api.rs index 4bc298c..8fcb19c 100644 --- a/crates/gitea-client/src/apis/issue_api.rs +++ b/crates/gitea-client/src/apis/issue_api.rs @@ -3,16 +3,18 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ use reqwest; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; +use super::{Error, configuration, ContentType}; +use tokio::fs::File as TokioFile; +use tokio_util::codec::{BytesCodec, FramedRead}; /// struct for typed errors of method [`issue_add_label`] @@ -87,6 +89,7 @@ pub enum IssueCreateIssueError { pub enum IssueCreateIssueAttachmentError { Status400(), Status404(), + Status413(), Status422(), Status423(), UnknownValue(serde_json::Value), @@ -107,6 +110,7 @@ pub enum IssueCreateIssueCommentAttachmentError { Status400(), Status403(), Status404(), + Status413(), Status422(), Status423(), UnknownValue(serde_json::Value), @@ -279,6 +283,7 @@ pub enum IssueEditIssueError { #[serde(untagged)] pub enum IssueEditIssueAttachmentError { Status404(), + Status422(), Status423(), UnknownValue(serde_json::Value), } @@ -288,6 +293,7 @@ pub enum IssueEditIssueAttachmentError { #[serde(untagged)] pub enum IssueEditIssueCommentAttachmentError { Status404(), + Status422(), Status423(), UnknownValue(serde_json::Value), } @@ -473,6 +479,15 @@ pub enum IssueListLabelsError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`issue_lock_issue`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum IssueLockIssueError { + Status403(), + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`issue_post_comment_reaction`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -541,6 +556,8 @@ pub enum IssueResetTimeError { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum IssueSearchIssuesError { + Status400(), + Status422(), UnknownValue(serde_json::Value), } @@ -580,6 +597,15 @@ pub enum IssueTrackedTimesError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`issue_unlock_issue`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum IssueUnlockIssueError { + Status403(), + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`move_issue_pin`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -609,5437 +635,6199 @@ pub enum UnpinIssueError { pub async fn issue_add_label(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Label>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Label>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_add_subscription(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, user: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_user = user; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions/{user}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, user=crate::apis::urlencode(p_path_user)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions/{user}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, user=crate::apis::urlencode(user)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_add_time(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TrackedTime`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TrackedTime`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_check_subscription(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions/check", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions/check", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WatchInfo`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WatchInfo`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_clear_labels(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_create_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Comment`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Comment`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_create_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Issue`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_create_issue_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, attachment: std::path::PathBuf, name: Option<&str>) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_form_attachment = attachment; + let p_query_name = name; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = name { - local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_name { + req_builder = req_builder.query(&[("name", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let mut local_var_form = reqwest::multipart::Form::new(); - // TODO: support file upload for 'attachment' parameter - local_var_req_builder = local_var_req_builder.multipart(local_var_form); + let mut multipart_form = reqwest::multipart::Form::new(); + let file = TokioFile::open(&p_form_attachment).await?; + let stream = FramedRead::new(file, BytesCodec::new()); + let file_name = p_form_attachment.file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_default(); + let file_part = reqwest::multipart::Part::stream(reqwest::Body::wrap_stream(stream)).file_name(file_name); + multipart_form = multipart_form.part("attachment", file_part); + req_builder = req_builder.multipart(multipart_form); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Attachment`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_create_issue_blocking(configuration: &configuration::Configuration, owner: &str, repo: &str, index: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/blocks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=crate::apis::urlencode(p_path_index)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/blocks", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=crate::apis::urlencode(index)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Issue`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_create_issue_comment_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment: std::path::PathBuf, name: Option<&str>) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_form_attachment = attachment; + let p_query_name = name; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/assets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/assets", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = name { - local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_name { + req_builder = req_builder.query(&[("name", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let mut local_var_form = reqwest::multipart::Form::new(); - // TODO: support file upload for 'attachment' parameter - local_var_req_builder = local_var_req_builder.multipart(local_var_form); + let mut multipart_form = reqwest::multipart::Form::new(); + let file = TokioFile::open(&p_form_attachment).await?; + let stream = FramedRead::new(file, BytesCodec::new()); + let file_name = p_form_attachment.file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_default(); + let file_part = reqwest::multipart::Part::stream(reqwest::Body::wrap_stream(stream)).file_name(file_name); + multipart_form = multipart_form.part("attachment", file_part); + req_builder = req_builder.multipart(multipart_form); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Attachment`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_create_issue_dependencies(configuration: &configuration::Configuration, owner: &str, repo: &str, index: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/dependencies", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=crate::apis::urlencode(p_path_index)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/dependencies", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=crate::apis::urlencode(index)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Issue`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_create_label(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/labels", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/labels", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Label`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Label`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_create_milestone(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/milestones", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/milestones", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Milestone`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Milestone`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_delete(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_delete_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } +#[deprecated] pub async fn issue_delete_comment_deprecated(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i32, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_delete_comment_reaction(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, content: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_body_content = content; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/reactions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&content); + req_builder = req_builder.json(&p_body_content); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_delete_issue_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, attachment_id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_attachment_id = attachment_id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, attachment_id=p_path_attachment_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets/{attachment_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, attachment_id=attachment_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_delete_issue_comment_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment_id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_path_attachment_id = attachment_id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id, attachment_id=p_path_attachment_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/assets/{attachment_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id, attachment_id=attachment_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_delete_issue_reaction(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, content: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_content = content; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/reactions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&content); + req_builder = req_builder.json(&p_body_content); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_delete_label(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/labels/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/labels/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_delete_milestone(configuration: &configuration::Configuration, owner: &str, repo: &str, id: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/milestones/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=crate::apis::urlencode(p_path_id)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/milestones/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=crate::apis::urlencode(id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_delete_stop_watch(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/stopwatch/delete", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/stopwatch/delete", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_delete_subscription(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, user: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_user = user; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions/{user}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, user=crate::apis::urlencode(p_path_user)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions/{user}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, user=crate::apis::urlencode(user)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_delete_time(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_edit_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Comment`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Comment`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } +#[deprecated] pub async fn issue_edit_comment_deprecated(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i32, id: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Comment`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Comment`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_edit_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Issue`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_edit_issue_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, attachment_id: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_attachment_id = attachment_id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, attachment_id=p_path_attachment_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets/{attachment_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, attachment_id=attachment_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Attachment`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_edit_issue_comment_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment_id: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_path_attachment_id = attachment_id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id, attachment_id=p_path_attachment_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/assets/{attachment_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id, attachment_id=attachment_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Attachment`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_edit_issue_deadline(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/deadline", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/deadline", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssueDeadline`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IssueDeadline`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_edit_label(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/labels/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/labels/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Label`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Label`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_edit_milestone(configuration: &configuration::Configuration, owner: &str, repo: &str, id: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/milestones/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=crate::apis::urlencode(p_path_id)); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/milestones/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=crate::apis::urlencode(id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Milestone`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Milestone`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_get_comment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Comment`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Comment`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_get_comment_reactions(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/reactions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Reaction>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Reaction>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_get_comments(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, since: Option, before: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_query_since = since; + let p_query_before = before; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/comments", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = since { - local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_since { + req_builder = req_builder.query(&[("since", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = before { - local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_before { + req_builder = req_builder.query(&[("before", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Comment>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Comment>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_get_comments_and_timeline(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, since: Option, page: Option, limit: Option, before: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_query_since = since; + let p_query_page = page; + let p_query_limit = limit; + let p_query_before = before; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/timeline", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/timeline", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = since { - local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_since { + req_builder = req_builder.query(&[("since", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = before { - local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_before { + req_builder = req_builder.query(&[("before", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TimelineComment>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::TimelineComment>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_get_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Issue`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_get_issue_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, attachment_id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_attachment_id = attachment_id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, attachment_id=p_path_attachment_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets/{attachment_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, attachment_id=attachment_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Attachment`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_get_issue_comment_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment_id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_path_attachment_id = attachment_id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id, attachment_id=p_path_attachment_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/assets/{attachment_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id, attachment_id=attachment_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Attachment`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_get_issue_reactions(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/reactions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Reaction>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Reaction>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_get_label(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/labels/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/labels/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Label`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Label`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_get_labels(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Label>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Label>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_get_milestone(configuration: &configuration::Configuration, owner: &str, repo: &str, id: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/milestones/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=crate::apis::urlencode(p_path_id)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/milestones/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=crate::apis::urlencode(id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Milestone`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Milestone`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_get_milestones_list(configuration: &configuration::Configuration, owner: &str, repo: &str, state: Option<&str>, name: Option<&str>, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_state = state; + let p_query_name = name; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/milestones", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/milestones", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = state { - local_var_req_builder = local_var_req_builder.query(&[("state", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_state { + req_builder = req_builder.query(&[("state", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = name { - local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_name { + req_builder = req_builder.query(&[("name", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Milestone>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Milestone>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_get_repo_comments(configuration: &configuration::Configuration, owner: &str, repo: &str, since: Option, before: Option, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_since = since; + let p_query_before = before; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = since { - local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_since { + req_builder = req_builder.query(&[("since", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = before { - local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_before { + req_builder = req_builder.query(&[("before", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Comment>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Comment>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_list_blocks(configuration: &configuration::Configuration, owner: &str, repo: &str, index: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/blocks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=crate::apis::urlencode(p_path_index)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/blocks", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=crate::apis::urlencode(index)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Issue>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Issue>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_list_issue_attachments(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/assets", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Attachment>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Attachment>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_list_issue_comment_attachments(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/assets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/assets", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Attachment>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Attachment>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_list_issue_dependencies(configuration: &configuration::Configuration, owner: &str, repo: &str, index: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/dependencies", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=crate::apis::urlencode(p_path_index)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/dependencies", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=crate::apis::urlencode(index)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Issue>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Issue>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_list_issues(configuration: &configuration::Configuration, owner: &str, repo: &str, state: Option<&str>, labels: Option<&str>, q: Option<&str>, r#type: Option<&str>, milestones: Option<&str>, since: Option, before: Option, created_by: Option<&str>, assigned_by: Option<&str>, mentioned_by: Option<&str>, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_state = state; + let p_query_labels = labels; + let p_query_q = q; + let p_query_type = r#type; + let p_query_milestones = milestones; + let p_query_since = since; + let p_query_before = before; + let p_query_created_by = created_by; + let p_query_assigned_by = assigned_by; + let p_query_mentioned_by = mentioned_by; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = state { - local_var_req_builder = local_var_req_builder.query(&[("state", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_state { + req_builder = req_builder.query(&[("state", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = labels { - local_var_req_builder = local_var_req_builder.query(&[("labels", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_labels { + req_builder = req_builder.query(&[("labels", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = q { - local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_q { + req_builder = req_builder.query(&[("q", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = r#type { - local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_type { + req_builder = req_builder.query(&[("type", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = milestones { - local_var_req_builder = local_var_req_builder.query(&[("milestones", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_milestones { + req_builder = req_builder.query(&[("milestones", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = since { - local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_since { + req_builder = req_builder.query(&[("since", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = before { - local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_before { + req_builder = req_builder.query(&[("before", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = created_by { - local_var_req_builder = local_var_req_builder.query(&[("created_by", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_created_by { + req_builder = req_builder.query(&[("created_by", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = assigned_by { - local_var_req_builder = local_var_req_builder.query(&[("assigned_by", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_assigned_by { + req_builder = req_builder.query(&[("assigned_by", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = mentioned_by { - local_var_req_builder = local_var_req_builder.query(&[("mentioned_by", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_mentioned_by { + req_builder = req_builder.query(&[("mentioned_by", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Issue>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Issue>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_list_labels(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/labels", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/labels", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Label>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Label>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn issue_lock_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; + + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/lock", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + req_builder = req_builder.json(&p_body_body); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_post_comment_reaction(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, content: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_body_content = content; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/reactions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/comments/{id}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&content); + req_builder = req_builder.json(&p_body_content); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Reaction`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Reaction`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_post_issue_reaction(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, content: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_content = content; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/reactions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/reactions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&content); + req_builder = req_builder.json(&p_body_content); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Reaction`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Reaction`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_remove_issue_blocking(configuration: &configuration::Configuration, owner: &str, repo: &str, index: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/blocks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=crate::apis::urlencode(p_path_index)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/blocks", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=crate::apis::urlencode(index)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Issue`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_remove_issue_dependencies(configuration: &configuration::Configuration, owner: &str, repo: &str, index: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/dependencies", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=crate::apis::urlencode(p_path_index)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/dependencies", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=crate::apis::urlencode(index)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Issue`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Issue`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_remove_label(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_replace_labels(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/labels", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Label>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Label>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_reset_time(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_search_issues(configuration: &configuration::Configuration, state: Option<&str>, labels: Option<&str>, milestones: Option<&str>, q: Option<&str>, priority_repo_id: Option, r#type: Option<&str>, since: Option, before: Option, assigned: Option, created: Option, mentioned: Option, review_requested: Option, reviewed: Option, owner: Option<&str>, team: Option<&str>, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_state = state; + let p_query_labels = labels; + let p_query_milestones = milestones; + let p_query_q = q; + let p_query_priority_repo_id = priority_repo_id; + let p_query_type = r#type; + let p_query_since = since; + let p_query_before = before; + let p_query_assigned = assigned; + let p_query_created = created; + let p_query_mentioned = mentioned; + let p_query_review_requested = review_requested; + let p_query_reviewed = reviewed; + let p_query_owner = owner; + let p_query_team = team; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/issues/search", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/issues/search", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = state { - local_var_req_builder = local_var_req_builder.query(&[("state", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_state { + req_builder = req_builder.query(&[("state", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = labels { - local_var_req_builder = local_var_req_builder.query(&[("labels", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_labels { + req_builder = req_builder.query(&[("labels", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = milestones { - local_var_req_builder = local_var_req_builder.query(&[("milestones", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_milestones { + req_builder = req_builder.query(&[("milestones", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = q { - local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_q { + req_builder = req_builder.query(&[("q", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = priority_repo_id { - local_var_req_builder = local_var_req_builder.query(&[("priority_repo_id", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_priority_repo_id { + req_builder = req_builder.query(&[("priority_repo_id", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = r#type { - local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_type { + req_builder = req_builder.query(&[("type", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = since { - local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_since { + req_builder = req_builder.query(&[("since", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = before { - local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_before { + req_builder = req_builder.query(&[("before", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = assigned { - local_var_req_builder = local_var_req_builder.query(&[("assigned", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_assigned { + req_builder = req_builder.query(&[("assigned", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = created { - local_var_req_builder = local_var_req_builder.query(&[("created", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_created { + req_builder = req_builder.query(&[("created", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = mentioned { - local_var_req_builder = local_var_req_builder.query(&[("mentioned", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_mentioned { + req_builder = req_builder.query(&[("mentioned", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = review_requested { - local_var_req_builder = local_var_req_builder.query(&[("review_requested", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_review_requested { + req_builder = req_builder.query(&[("review_requested", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = reviewed { - local_var_req_builder = local_var_req_builder.query(&[("reviewed", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_reviewed { + req_builder = req_builder.query(&[("reviewed", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = owner { - local_var_req_builder = local_var_req_builder.query(&[("owner", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_owner { + req_builder = req_builder.query(&[("owner", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = team { - local_var_req_builder = local_var_req_builder.query(&[("team", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_team { + req_builder = req_builder.query(&[("team", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Issue>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Issue>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_start_stop_watch(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/stopwatch/start", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/stopwatch/start", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_stop_stop_watch(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/stopwatch/stop", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/stopwatch/stop", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_subscriptions(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/subscriptions", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn issue_tracked_times(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, user: Option<&str>, since: Option, before: Option, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_query_user = user; + let p_query_since = since; + let p_query_before = before; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/times", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = user { - local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_user { + req_builder = req_builder.query(&[("user", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = since { - local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_since { + req_builder = req_builder.query(&[("since", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = before { - local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_before { + req_builder = req_builder.query(&[("before", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TrackedTime>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::TrackedTime>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn issue_unlock_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/lock", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn move_issue_pin(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, position: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_position = position; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/pin/{position}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, position=p_path_position); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/pin/{position}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, position=position); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn pin_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/pin", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/pin", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn unpin_issue(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/pin", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/{index}/pin", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } diff --git a/crates/gitea-client/src/apis/miscellaneous_api.rs b/crates/gitea-client/src/apis/miscellaneous_api.rs index 04878c9..6ce319c 100644 --- a/crates/gitea-client/src/apis/miscellaneous_api.rs +++ b/crates/gitea-client/src/apis/miscellaneous_api.rs @@ -3,16 +3,16 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ use reqwest; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; +use super::{Error, configuration, ContentType}; /// struct for typed errors of method [`get_gitignore_template_info`] @@ -53,6 +53,13 @@ pub enum GetSigningKeyError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_signing_key_ssh`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetSigningKeySshError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`get_version`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -107,941 +114,1122 @@ pub enum RenderMarkupError { pub async fn get_gitignore_template_info(configuration: &configuration::Configuration, name: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_name = name; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/gitignore/templates/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/gitignore/templates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GitignoreTemplateInfo`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GitignoreTemplateInfo`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_label_template_info(configuration: &configuration::Configuration, name: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_name = name; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/label/templates/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/label/templates/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::LabelTemplate>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::LabelTemplate>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_license_template_info(configuration: &configuration::Configuration, name: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_name = name; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/licenses/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/licenses/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicenseTemplateInfo`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LicenseTemplateInfo`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_node_info(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/nodeinfo", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/nodeinfo", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodeInfo`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodeInfo`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_signing_key(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/signing-key.gpg", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/signing-key.gpg", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Ok(content), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_signing_key_ssh(configuration: &configuration::Configuration, ) -> Result> { + + let uri_str = format!("{}/signing-key.pub", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Ok(content), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_version(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/version", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/version", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ServerVersion`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ServerVersion`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn list_gitignores_templates(configuration: &configuration::Configuration, ) -> Result, Error> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/gitignore/templates", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/gitignore/templates", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<String>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn list_label_templates(configuration: &configuration::Configuration, ) -> Result, Error> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/label/templates", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/label/templates", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<String>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn list_license_templates(configuration: &configuration::Configuration, ) -> Result, Error> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/licenses", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/licenses", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::LicensesTemplateListEntry>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::LicensesTemplateListEntry>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn render_markdown(configuration: &configuration::Configuration, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/markdown", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/markdown", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn render_markdown_raw(configuration: &configuration::Configuration, body: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/markdown/raw", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/markdown/raw", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn render_markup(configuration: &configuration::Configuration, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/markup", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/markup", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `String`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } diff --git a/crates/gitea-client/src/apis/mod.rs b/crates/gitea-client/src/apis/mod.rs index cecf4de..8e80732 100644 --- a/crates/gitea-client/src/apis/mod.rs +++ b/crates/gitea-client/src/apis/mod.rs @@ -90,6 +90,27 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String unimplemented!("Only objects are supported with style=deepObject") } +/// Internal use only +/// A content type supported by this client. +#[allow(dead_code)] +enum ContentType { + Json, + Text, + Unsupported(String) +} + +impl From<&str> for ContentType { + fn from(content_type: &str) -> Self { + if content_type.starts_with("application") && content_type.contains("json") { + return Self::Json; + } else if content_type.starts_with("text/plain") { + return Self::Text; + } else { + return Self::Unsupported(content_type.to_string()); + } + } +} + pub mod activitypub_api; pub mod admin_api; pub mod issue_api; diff --git a/crates/gitea-client/src/apis/notification_api.rs b/crates/gitea-client/src/apis/notification_api.rs index 87cd4bc..8673877 100644 --- a/crates/gitea-client/src/apis/notification_api.rs +++ b/crates/gitea-client/src/apis/notification_api.rs @@ -3,16 +3,16 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ use reqwest; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; +use super::{Error, configuration, ContentType}; /// struct for typed errors of method [`notify_get_list`] @@ -70,635 +70,719 @@ pub enum NotifyReadThreadError { pub async fn notify_get_list(configuration: &configuration::Configuration, all: Option, status_types: Option>, subject_type: Option>, since: Option, before: Option, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_all = all; + let p_query_status_types = status_types; + let p_query_subject_type = subject_type; + let p_query_since = since; + let p_query_before = before; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/notifications", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/notifications", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = all { - local_var_req_builder = local_var_req_builder.query(&[("all", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_all { + req_builder = req_builder.query(&[("all", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = status_types { - local_var_req_builder = match "multi" { - "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::>()), - _ => local_var_req_builder.query(&[("status-types", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), + if let Some(ref param_value) = p_query_status_types { + req_builder = match "multi" { + "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::>()), + _ => req_builder.query(&[("status-types", ¶m_value.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; } - if let Some(ref local_var_str) = subject_type { - local_var_req_builder = match "multi" { - "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("subject-type".to_owned(), p.to_string())).collect::>()), - _ => local_var_req_builder.query(&[("subject-type", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), + if let Some(ref param_value) = p_query_subject_type { + req_builder = match "multi" { + "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("subject-type".to_owned(), p.to_string())).collect::>()), + _ => req_builder.query(&[("subject-type", ¶m_value.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; } - if let Some(ref local_var_str) = since { - local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_since { + req_builder = req_builder.query(&[("since", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = before { - local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_before { + req_builder = req_builder.query(&[("before", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::NotificationThread>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::NotificationThread>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn notify_get_repo_list(configuration: &configuration::Configuration, owner: &str, repo: &str, all: Option, status_types: Option>, subject_type: Option>, since: Option, before: Option, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_all = all; + let p_query_status_types = status_types; + let p_query_subject_type = subject_type; + let p_query_since = since; + let p_query_before = before; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/notifications", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/notifications", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = all { - local_var_req_builder = local_var_req_builder.query(&[("all", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_all { + req_builder = req_builder.query(&[("all", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = status_types { - local_var_req_builder = match "multi" { - "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::>()), - _ => local_var_req_builder.query(&[("status-types", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), + if let Some(ref param_value) = p_query_status_types { + req_builder = match "multi" { + "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::>()), + _ => req_builder.query(&[("status-types", ¶m_value.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; } - if let Some(ref local_var_str) = subject_type { - local_var_req_builder = match "multi" { - "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("subject-type".to_owned(), p.to_string())).collect::>()), - _ => local_var_req_builder.query(&[("subject-type", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), + if let Some(ref param_value) = p_query_subject_type { + req_builder = match "multi" { + "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("subject-type".to_owned(), p.to_string())).collect::>()), + _ => req_builder.query(&[("subject-type", ¶m_value.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; } - if let Some(ref local_var_str) = since { - local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_since { + req_builder = req_builder.query(&[("since", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = before { - local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_before { + req_builder = req_builder.query(&[("before", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::NotificationThread>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::NotificationThread>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn notify_get_thread(configuration: &configuration::Configuration, id: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/notifications/threads/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/notifications/threads/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NotificationThread`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NotificationThread`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn notify_new_available(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/notifications/new", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/notifications/new", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NotificationCount`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NotificationCount`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn notify_read_list(configuration: &configuration::Configuration, last_read_at: Option, all: Option<&str>, status_types: Option>, to_status: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_last_read_at = last_read_at; + let p_query_all = all; + let p_query_status_types = status_types; + let p_query_to_status = to_status; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/notifications", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/notifications", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = last_read_at { - local_var_req_builder = local_var_req_builder.query(&[("last_read_at", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_last_read_at { + req_builder = req_builder.query(&[("last_read_at", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = all { - local_var_req_builder = local_var_req_builder.query(&[("all", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_all { + req_builder = req_builder.query(&[("all", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = status_types { - local_var_req_builder = match "multi" { - "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::>()), - _ => local_var_req_builder.query(&[("status-types", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), + if let Some(ref param_value) = p_query_status_types { + req_builder = match "multi" { + "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::>()), + _ => req_builder.query(&[("status-types", ¶m_value.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; } - if let Some(ref local_var_str) = to_status { - local_var_req_builder = local_var_req_builder.query(&[("to-status", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_to_status { + req_builder = req_builder.query(&[("to-status", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::NotificationThread>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::NotificationThread>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn notify_read_repo_list(configuration: &configuration::Configuration, owner: &str, repo: &str, all: Option<&str>, status_types: Option>, to_status: Option<&str>, last_read_at: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_all = all; + let p_query_status_types = status_types; + let p_query_to_status = to_status; + let p_query_last_read_at = last_read_at; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/notifications", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/notifications", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = all { - local_var_req_builder = local_var_req_builder.query(&[("all", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_all { + req_builder = req_builder.query(&[("all", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = status_types { - local_var_req_builder = match "multi" { - "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::>()), - _ => local_var_req_builder.query(&[("status-types", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), + if let Some(ref param_value) = p_query_status_types { + req_builder = match "multi" { + "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::>()), + _ => req_builder.query(&[("status-types", ¶m_value.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; } - if let Some(ref local_var_str) = to_status { - local_var_req_builder = local_var_req_builder.query(&[("to-status", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_to_status { + req_builder = req_builder.query(&[("to-status", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = last_read_at { - local_var_req_builder = local_var_req_builder.query(&[("last_read_at", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_last_read_at { + req_builder = req_builder.query(&[("last_read_at", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::NotificationThread>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::NotificationThread>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn notify_read_thread(configuration: &configuration::Configuration, id: &str, to_status: Option<&str>) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_query_to_status = to_status; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/notifications/threads/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id)); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/notifications/threads/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = to_status { - local_var_req_builder = local_var_req_builder.query(&[("to-status", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_to_status { + req_builder = req_builder.query(&[("to-status", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NotificationThread`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NotificationThread`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } diff --git a/crates/gitea-client/src/apis/organization_api.rs b/crates/gitea-client/src/apis/organization_api.rs index 8624e00..0bff8dc 100644 --- a/crates/gitea-client/src/apis/organization_api.rs +++ b/crates/gitea-client/src/apis/organization_api.rs @@ -3,16 +3,16 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ use reqwest; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; +use super::{Error, configuration, ContentType}; /// struct for typed errors of method [`create_org_repo`] @@ -39,6 +39,16 @@ pub enum CreateOrgRepoDeprecatedError { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum CreateOrgVariableError { + Status400(), + Status409(), + Status500(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`delete_org_runner`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteOrgRunnerError { Status400(), Status404(), UnknownValue(serde_json::Value), @@ -62,6 +72,24 @@ pub enum DeleteOrgVariableError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_org_runner`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetOrgRunnerError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_org_runners`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetOrgRunnersError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`get_org_variable`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -80,6 +108,24 @@ pub enum GetOrgVariablesListError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_org_workflow_jobs`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetOrgWorkflowJobsError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_org_workflow_runs`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetOrgWorkflowRunsError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`org_add_team_member`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -133,6 +179,13 @@ pub enum OrgCreateLabelError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`org_create_runner_registration_token`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum OrgCreateRunnerRegistrationTokenError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`org_create_team`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -481,6 +534,15 @@ pub enum OrganizationUnblockUserError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`rename_org`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RenameOrgError { + Status403(), + Status422(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`team_search`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -509,4736 +571,5693 @@ pub enum UpdateOrgVariableError { pub async fn create_org_repo(configuration: &configuration::Configuration, org: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/repos", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/repos", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } +#[deprecated] pub async fn create_org_repo_deprecated(configuration: &configuration::Configuration, org: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/org/{org}/repos", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/org/{org}/repos", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn create_org_variable(configuration: &configuration::Configuration, org: &str, variablename: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_variablename = variablename; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/actions/variables/{variablename}", configuration.base_path, org=crate::apis::urlencode(p_path_org), variablename=crate::apis::urlencode(p_path_variablename)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/actions/variables/{variablename}", local_var_configuration.base_path, org=crate::apis::urlencode(org), variablename=crate::apis::urlencode(variablename)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn delete_org_runner(configuration: &configuration::Configuration, org: &str, runner_id: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_runner_id = runner_id; + + let uri_str = format!("{}/orgs/{org}/actions/runners/{runner_id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), runner_id=crate::apis::urlencode(p_path_runner_id)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn delete_org_secret(configuration: &configuration::Configuration, org: &str, secretname: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_secretname = secretname; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/actions/secrets/{secretname}", configuration.base_path, org=crate::apis::urlencode(p_path_org), secretname=crate::apis::urlencode(p_path_secretname)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/actions/secrets/{secretname}", local_var_configuration.base_path, org=crate::apis::urlencode(org), secretname=crate::apis::urlencode(secretname)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn delete_org_variable(configuration: &configuration::Configuration, org: &str, variablename: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_variablename = variablename; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/actions/variables/{variablename}", configuration.base_path, org=crate::apis::urlencode(p_path_org), variablename=crate::apis::urlencode(p_path_variablename)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/actions/variables/{variablename}", local_var_configuration.base_path, org=crate::apis::urlencode(org), variablename=crate::apis::urlencode(variablename)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionVariable`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionVariable`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_org_runner(configuration: &configuration::Configuration, org: &str, runner_id: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_runner_id = runner_id; + + let uri_str = format!("{}/orgs/{org}/actions/runners/{runner_id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), runner_id=crate::apis::urlencode(p_path_runner_id)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_org_runners(configuration: &configuration::Configuration, org: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + + let uri_str = format!("{}/orgs/{org}/actions/runners", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_org_variable(configuration: &configuration::Configuration, org: &str, variablename: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_variablename = variablename; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/actions/variables/{variablename}", configuration.base_path, org=crate::apis::urlencode(p_path_org), variablename=crate::apis::urlencode(p_path_variablename)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/actions/variables/{variablename}", local_var_configuration.base_path, org=crate::apis::urlencode(org), variablename=crate::apis::urlencode(variablename)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionVariable`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionVariable`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_org_variables_list(configuration: &configuration::Configuration, org: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/actions/variables", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/actions/variables", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ActionVariable>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ActionVariable>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_org_workflow_jobs(configuration: &configuration::Configuration, org: &str, status: Option<&str>, page: Option, limit: Option) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_query_status = status; + let p_query_page = page; + let p_query_limit = limit; + + let uri_str = format!("{}/orgs/{org}/actions/jobs", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_status { + req_builder = req_builder.query(&[("status", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_org_workflow_runs(configuration: &configuration::Configuration, org: &str, event: Option<&str>, branch: Option<&str>, status: Option<&str>, actor: Option<&str>, head_sha: Option<&str>, page: Option, limit: Option) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_query_event = event; + let p_query_branch = branch; + let p_query_status = status; + let p_query_actor = actor; + let p_query_head_sha = head_sha; + let p_query_page = page; + let p_query_limit = limit; + + let uri_str = format!("{}/orgs/{org}/actions/runs", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_event { + req_builder = req_builder.query(&[("event", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_branch { + req_builder = req_builder.query(&[("branch", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_status { + req_builder = req_builder.query(&[("status", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_actor { + req_builder = req_builder.query(&[("actor", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_head_sha { + req_builder = req_builder.query(&[("head_sha", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowRunsResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowRunsResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_add_team_member(configuration: &configuration::Configuration, id: i64, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/teams/{id}/members/{username}", configuration.base_path, id=p_path_id, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/teams/{id}/members/{username}", local_var_configuration.base_path, id=id, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_add_team_repository(configuration: &configuration::Configuration, id: i64, org: &str, repo: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_path_org = org; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/teams/{id}/repos/{org}/{repo}", configuration.base_path, id=p_path_id, org=crate::apis::urlencode(p_path_org), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/teams/{id}/repos/{org}/{repo}", local_var_configuration.base_path, id=id, org=crate::apis::urlencode(org), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_conceal_member(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/public_members/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/public_members/{username}", local_var_configuration.base_path, org=crate::apis::urlencode(org), username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_create(configuration: &configuration::Configuration, organization: models::CreateOrgOption) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_organization = organization; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/orgs", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&organization); + req_builder = req_builder.json(&p_body_organization); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Organization`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_create_hook(configuration: &configuration::Configuration, org: &str, body: models::CreateHookOption) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/hooks", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/hooks", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_create_label(configuration: &configuration::Configuration, org: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/labels", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/labels", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Label`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Label`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn org_create_runner_registration_token(configuration: &configuration::Configuration, org: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + + let uri_str = format!("{}/orgs/{org}/actions/runners/registration-token", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_create_team(configuration: &configuration::Configuration, org: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/teams", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/teams", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Team`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Team`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_delete(configuration: &configuration::Configuration, org: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_delete_avatar(configuration: &configuration::Configuration, org: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/avatar", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/avatar", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_delete_hook(configuration: &configuration::Configuration, org: &str, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/hooks/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/hooks/{id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_delete_label(configuration: &configuration::Configuration, org: &str, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/labels/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/labels/{id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_delete_member(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/members/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/members/{username}", local_var_configuration.base_path, org=crate::apis::urlencode(org), username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_delete_team(configuration: &configuration::Configuration, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/teams/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/teams/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_edit(configuration: &configuration::Configuration, org: &str, body: models::EditOrgOption) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Organization`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_edit_hook(configuration: &configuration::Configuration, org: &str, id: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/hooks/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/hooks/{id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_edit_label(configuration: &configuration::Configuration, org: &str, id: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/labels/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/labels/{id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Label`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Label`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_edit_team(configuration: &configuration::Configuration, id: i32, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/teams/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/teams/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Team`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Team`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_get(configuration: &configuration::Configuration, org: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Organization`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_get_all(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Organization>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Organization>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_get_hook(configuration: &configuration::Configuration, org: &str, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/hooks/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/hooks/{id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_get_label(configuration: &configuration::Configuration, org: &str, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/labels/{id}", configuration.base_path, org=crate::apis::urlencode(p_path_org), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/labels/{id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Label`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Label`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_get_runner_registration_token(configuration: &configuration::Configuration, org: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/actions/runners/registration-token", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/actions/runners/registration-token", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_get_team(configuration: &configuration::Configuration, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/teams/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/teams/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Team`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Team`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_get_user_permissions(configuration: &configuration::Configuration, username: &str, org: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_path_org = org; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/orgs/{org}/permissions", configuration.base_path, username=crate::apis::urlencode(p_path_username), org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/orgs/{org}/permissions", local_var_configuration.base_path, username=crate::apis::urlencode(username), org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationPermissions`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OrganizationPermissions`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_is_member(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/members/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/members/{username}", local_var_configuration.base_path, org=crate::apis::urlencode(org), username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_is_public_member(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/public_members/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/public_members/{username}", local_var_configuration.base_path, org=crate::apis::urlencode(org), username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_actions_secrets(configuration: &configuration::Configuration, org: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/actions/secrets", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/actions/secrets", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Secret>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Secret>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_activity_feeds(configuration: &configuration::Configuration, org: &str, date: Option, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_query_date = date; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/activities/feeds", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/activities/feeds", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = date { - local_var_req_builder = local_var_req_builder.query(&[("date", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_date { + req_builder = req_builder.query(&[("date", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Activity>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Activity>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_current_user_orgs(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/orgs", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/orgs", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Organization>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Organization>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_hooks(configuration: &configuration::Configuration, org: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/hooks", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/hooks", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Hook>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Hook>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_labels(configuration: &configuration::Configuration, org: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/labels", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/labels", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Label>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Label>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_members(configuration: &configuration::Configuration, org: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/members", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/members", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_public_members(configuration: &configuration::Configuration, org: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/public_members", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/public_members", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_repos(configuration: &configuration::Configuration, org: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/repos", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/repos", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Repository>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Repository>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_team_activity_feeds(configuration: &configuration::Configuration, id: i64, date: Option, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_query_date = date; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/teams/{id}/activities/feeds", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/teams/{id}/activities/feeds", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = date { - local_var_req_builder = local_var_req_builder.query(&[("date", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_date { + req_builder = req_builder.query(&[("date", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Activity>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Activity>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_team_member(configuration: &configuration::Configuration, id: i64, username: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/teams/{id}/members/{username}", configuration.base_path, id=p_path_id, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/teams/{id}/members/{username}", local_var_configuration.base_path, id=id, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::User`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::User`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_team_members(configuration: &configuration::Configuration, id: i64, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/teams/{id}/members", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/teams/{id}/members", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_team_repo(configuration: &configuration::Configuration, id: i64, org: &str, repo: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_path_org = org; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/teams/{id}/repos/{org}/{repo}", configuration.base_path, id=p_path_id, org=crate::apis::urlencode(p_path_org), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/teams/{id}/repos/{org}/{repo}", local_var_configuration.base_path, id=id, org=crate::apis::urlencode(org), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_team_repos(configuration: &configuration::Configuration, id: i64, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/teams/{id}/repos", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/teams/{id}/repos", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Repository>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Repository>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_teams(configuration: &configuration::Configuration, org: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/teams", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/teams", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Team>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Team>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_list_user_orgs(configuration: &configuration::Configuration, username: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/orgs", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/orgs", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Organization>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Organization>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_publicize_member(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/public_members/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/public_members/{username}", local_var_configuration.base_path, org=crate::apis::urlencode(org), username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_remove_team_member(configuration: &configuration::Configuration, id: i64, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/teams/{id}/members/{username}", configuration.base_path, id=p_path_id, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/teams/{id}/members/{username}", local_var_configuration.base_path, id=id, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } /// This does not delete the repository, it only removes the repository from the team. pub async fn org_remove_team_repository(configuration: &configuration::Configuration, id: i64, org: &str, repo: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_path_org = org; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/teams/{id}/repos/{org}/{repo}", configuration.base_path, id=p_path_id, org=crate::apis::urlencode(p_path_org), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/teams/{id}/repos/{org}/{repo}", local_var_configuration.base_path, id=id, org=crate::apis::urlencode(org), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn org_update_avatar(configuration: &configuration::Configuration, org: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/avatar", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/avatar", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn organization_block_user(configuration: &configuration::Configuration, org: &str, username: &str, note: Option<&str>) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_username = username; + let p_query_note = note; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/blocks/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/blocks/{username}", local_var_configuration.base_path, org=crate::apis::urlencode(org), username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = note { - local_var_req_builder = local_var_req_builder.query(&[("note", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_note { + req_builder = req_builder.query(&[("note", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn organization_check_user_block(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/blocks/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/blocks/{username}", local_var_configuration.base_path, org=crate::apis::urlencode(org), username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn organization_list_blocks(configuration: &configuration::Configuration, org: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/blocks", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/blocks", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn organization_unblock_user(configuration: &configuration::Configuration, org: &str, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/blocks/{username}", configuration.base_path, org=crate::apis::urlencode(p_path_org), username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/blocks/{username}", local_var_configuration.base_path, org=crate::apis::urlencode(org), username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn rename_org(configuration: &configuration::Configuration, org: &str, body: models::RenameOrgOption) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_body_body = body; + + let uri_str = format!("{}/orgs/{org}/rename", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + req_builder = req_builder.json(&p_body_body); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn team_search(configuration: &configuration::Configuration, org: &str, q: Option<&str>, include_desc: Option, page: Option, limit: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_query_q = q; + let p_query_include_desc = include_desc; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/teams/search", configuration.base_path, org=crate::apis::urlencode(p_path_org)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/teams/search", local_var_configuration.base_path, org=crate::apis::urlencode(org)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = q { - local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_q { + req_builder = req_builder.query(&[("q", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = include_desc { - local_var_req_builder = local_var_req_builder.query(&[("include_desc", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_include_desc { + req_builder = req_builder.query(&[("include_desc", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TeamSearch200Response`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TeamSearch200Response`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn update_org_secret(configuration: &configuration::Configuration, org: &str, secretname: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_secretname = secretname; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/actions/secrets/{secretname}", configuration.base_path, org=crate::apis::urlencode(p_path_org), secretname=crate::apis::urlencode(p_path_secretname)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/actions/secrets/{secretname}", local_var_configuration.base_path, org=crate::apis::urlencode(org), secretname=crate::apis::urlencode(secretname)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn update_org_variable(configuration: &configuration::Configuration, org: &str, variablename: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_org = org; + let p_path_variablename = variablename; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/orgs/{org}/actions/variables/{variablename}", configuration.base_path, org=crate::apis::urlencode(p_path_org), variablename=crate::apis::urlencode(p_path_variablename)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/orgs/{org}/actions/variables/{variablename}", local_var_configuration.base_path, org=crate::apis::urlencode(org), variablename=crate::apis::urlencode(variablename)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } diff --git a/crates/gitea-client/src/apis/package_api.rs b/crates/gitea-client/src/apis/package_api.rs index ad104a6..a17f7c5 100644 --- a/crates/gitea-client/src/apis/package_api.rs +++ b/crates/gitea-client/src/apis/package_api.rs @@ -3,16 +3,16 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ use reqwest; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; +use super::{Error, configuration, ContentType}; /// struct for typed errors of method [`delete_package`] @@ -23,6 +23,14 @@ pub enum DeletePackageError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_latest_package_version`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetLatestPackageVersionError { + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`get_package`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -31,6 +39,14 @@ pub enum GetPackageError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`link_package`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum LinkPackageError { + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`list_package_files`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -39,6 +55,14 @@ pub enum ListPackageFilesError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`list_package_versions`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListPackageVersionsError { + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`list_packages`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -47,328 +71,717 @@ pub enum ListPackagesError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`unlink_package`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UnlinkPackageError { + Status404(), + UnknownValue(serde_json::Value), +} + pub async fn delete_package(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str, version: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_type = r#type; + let p_path_name = name; + let p_path_version = version; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/packages/{owner}/{type}/{name}/{version}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), type=crate::apis::urlencode(p_path_type), name=crate::apis::urlencode(p_path_name), version=crate::apis::urlencode(p_path_version)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/packages/{owner}/{type}/{name}/{version}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), type=crate::apis::urlencode(r#type), name=crate::apis::urlencode(name), version=crate::apis::urlencode(version)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_latest_package_version(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_type = r#type; + let p_path_name = name; + + let uri_str = format!("{}/packages/{owner}/{type}/{name}/-/latest", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), type=crate::apis::urlencode(p_path_type), name=crate::apis::urlencode(p_path_name)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Package`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Package`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_package(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str, version: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_type = r#type; + let p_path_name = name; + let p_path_version = version; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/packages/{owner}/{type}/{name}/{version}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), type=crate::apis::urlencode(p_path_type), name=crate::apis::urlencode(p_path_name), version=crate::apis::urlencode(p_path_version)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/packages/{owner}/{type}/{name}/{version}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), type=crate::apis::urlencode(r#type), name=crate::apis::urlencode(name), version=crate::apis::urlencode(version)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Package`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Package`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn link_package(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str, repo_name: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_type = r#type; + let p_path_name = name; + let p_path_repo_name = repo_name; + + let uri_str = format!("{}/packages/{owner}/{type}/{name}/-/link/{repo_name}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), type=crate::apis::urlencode(p_path_type), name=crate::apis::urlencode(p_path_name), repo_name=crate::apis::urlencode(p_path_repo_name)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn list_package_files(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str, version: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_type = r#type; + let p_path_name = name; + let p_path_version = version; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/packages/{owner}/{type}/{name}/{version}/files", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), type=crate::apis::urlencode(p_path_type), name=crate::apis::urlencode(p_path_name), version=crate::apis::urlencode(p_path_version)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/packages/{owner}/{type}/{name}/{version}/files", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), type=crate::apis::urlencode(r#type), name=crate::apis::urlencode(name), version=crate::apis::urlencode(version)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PackageFile>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PackageFile>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn list_package_versions(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str, page: Option, limit: Option) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_type = r#type; + let p_path_name = name; + let p_query_page = page; + let p_query_limit = limit; + + let uri_str = format!("{}/packages/{owner}/{type}/{name}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), type=crate::apis::urlencode(p_path_type), name=crate::apis::urlencode(p_path_name)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Package>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Package>`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn list_packages(configuration: &configuration::Configuration, owner: &str, page: Option, limit: Option, r#type: Option<&str>, q: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_query_page = page; + let p_query_limit = limit; + let p_query_type = r#type; + let p_query_q = q; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/packages/{owner}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/packages/{owner}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = r#type { - local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_type { + req_builder = req_builder.query(&[("type", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = q { - local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_q { + req_builder = req_builder.query(&[("q", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Package>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Package>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn unlink_package(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_type = r#type; + let p_path_name = name; + + let uri_str = format!("{}/packages/{owner}/{type}/{name}/-/unlink", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), type=crate::apis::urlencode(p_path_type), name=crate::apis::urlencode(p_path_name)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } diff --git a/crates/gitea-client/src/apis/repository_api.rs b/crates/gitea-client/src/apis/repository_api.rs index 7ff8e38..c469e33 100644 --- a/crates/gitea-client/src/apis/repository_api.rs +++ b/crates/gitea-client/src/apis/repository_api.rs @@ -3,16 +3,18 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ use reqwest; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; +use super::{Error, configuration, ContentType}; +use tokio::fs::File as TokioFile; +use tokio_util::codec::{BytesCodec, FramedRead}; /// struct for typed errors of method [`accept_repo_transfer`] @@ -24,6 +26,64 @@ pub enum AcceptRepoTransferError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`actions_disable_workflow`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ActionsDisableWorkflowError { + Status400(), + Status403(), + Status404(), + Status422(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`actions_dispatch_workflow`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ActionsDispatchWorkflowError { + Status400(), + Status403(), + Status404(), + Status422(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`actions_enable_workflow`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ActionsEnableWorkflowError { + Status400(), + Status403(), + Status404(), + Status409(), + Status422(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`actions_get_workflow`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ActionsGetWorkflowError { + Status400(), + Status403(), + Status404(), + Status422(), + Status500(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`actions_list_repository_workflows`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ActionsListRepositoryWorkflowsError { + Status400(), + Status403(), + Status404(), + Status422(), + Status500(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`create_current_user_repo`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -49,6 +109,34 @@ pub enum CreateForkError { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum CreateRepoVariableError { + Status400(), + Status409(), + Status500(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`delete_action_run`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteActionRunError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`delete_artifact`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteArtifactError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`delete_repo_runner`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteRepoRunnerError { Status400(), Status404(), UnknownValue(serde_json::Value), @@ -72,6 +160,24 @@ pub enum DeleteRepoVariableError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`download_actions_run_job_logs`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DownloadActionsRunJobLogsError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`download_artifact`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DownloadArtifactError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`generate_repo`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -92,6 +198,33 @@ pub enum GetAnnotatedTagError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_artifact`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetArtifactError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_artifacts`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetArtifactsError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_artifacts_of_run`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetArtifactsOfRunError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`get_blob`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -101,6 +234,24 @@ pub enum GetBlobError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_repo_runner`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetRepoRunnerError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_repo_runners`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetRepoRunnersError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`get_repo_variable`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -128,6 +279,45 @@ pub enum GetTreeError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_workflow_job`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetWorkflowJobError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_workflow_run`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetWorkflowRunError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_workflow_runs`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetWorkflowRunsError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`list_action_tasks`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListActionTasksError { + Status400(), + Status403(), + Status404(), + Status409(), + Status422(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`list_forks`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -136,6 +326,24 @@ pub enum ListForksError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`list_workflow_jobs`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListWorkflowJobsError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`list_workflow_run_jobs`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListWorkflowRunJobsError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`reject_repo_transfer`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -336,6 +544,14 @@ pub enum RepoCreateReleaseError { pub enum RepoCreateReleaseAttachmentError { Status400(), Status404(), + Status413(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`repo_create_runner_registration_token`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoCreateRunnerRegistrationTokenError { UnknownValue(serde_json::Value), } @@ -360,6 +576,17 @@ pub enum RepoCreateTagError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`repo_create_tag_protection`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoCreateTagProtectionError { + Status403(), + Status404(), + Status422(), + Status423(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`repo_create_wiki_page`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -422,6 +649,7 @@ pub enum RepoDeleteFileError { Status400(), Status403(), Status404(), + Status422(), Status423(), UnknownValue(serde_json::Value), } @@ -517,6 +745,14 @@ pub enum RepoDeleteTagError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`repo_delete_tag_protection`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoDeleteTagProtectionError { + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`repo_delete_team`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -633,6 +869,17 @@ pub enum RepoEditReleaseError { #[serde(untagged)] pub enum RepoEditReleaseAttachmentError { Status404(), + Status422(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`repo_edit_tag_protection`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoEditTagProtectionError { + Status404(), + Status422(), + Status423(), UnknownValue(serde_json::Value), } @@ -729,6 +976,14 @@ pub enum RepoGetContentsError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`repo_get_contents_ext`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoGetContentsExtError { + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`repo_get_contents_list`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -745,6 +1000,22 @@ pub enum RepoGetEditorConfigError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`repo_get_file_contents`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoGetFileContentsError { + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`repo_get_file_contents_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoGetFileContentsPostError { + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`repo_get_git_hook`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -801,6 +1072,14 @@ pub enum RepoGetLatestReleaseError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`repo_get_licenses`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoGetLicensesError { + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`repo_get_note`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -949,6 +1228,14 @@ pub enum RepoGetTagError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`repo_get_tag_protection`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoGetTagProtectionError { + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`repo_get_wiki_page`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1072,6 +1359,7 @@ pub enum RepoListPinnedPullRequestsError { #[serde(untagged)] pub enum RepoListPullRequestsError { Status404(), + Status500(), UnknownValue(serde_json::Value), } @@ -1113,6 +1401,7 @@ pub enum RepoListReleasesError { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum RepoListStargazersError { + Status403(), Status404(), UnknownValue(serde_json::Value), } @@ -1143,6 +1432,13 @@ pub enum RepoListSubscribersError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`repo_list_tag_protection`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoListTagProtectionError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`repo_list_tags`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1178,6 +1474,15 @@ pub enum RepoMergePullRequestError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`repo_merge_upstream`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoMergeUpstreamError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`repo_migrate`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1223,6 +1528,16 @@ pub enum RepoPushMirrorSyncError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`repo_rename_branch`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoRenameBranchError { + Status403(), + Status404(), + Status422(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`repo_search`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1238,6 +1553,13 @@ pub enum RepoSigningKeyError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`repo_signing_key_ssh`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoSigningKeySshError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`repo_submit_pull_review`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1293,6 +1615,16 @@ pub enum RepoUpdateAvatarError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`repo_update_branch_protection_priories`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RepoUpdateBranchProtectionPrioriesError { + Status404(), + Status422(), + Status423(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`repo_update_file`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1396,12550 +1728,16978 @@ pub enum UserTrackedTimesError { pub async fn accept_repo_transfer(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/transfer/accept", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/transfer/accept", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn actions_disable_workflow(configuration: &configuration::Configuration, owner: &str, repo: &str, workflow_id: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_workflow_id = workflow_id; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), workflow_id=crate::apis::urlencode(p_path_workflow_id)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn actions_dispatch_workflow(configuration: &configuration::Configuration, owner: &str, repo: &str, workflow_id: &str, body: Option) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_workflow_id = workflow_id; + let p_body_body = body; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), workflow_id=crate::apis::urlencode(p_path_workflow_id)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + req_builder = req_builder.json(&p_body_body); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn actions_enable_workflow(configuration: &configuration::Configuration, owner: &str, repo: &str, workflow_id: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_workflow_id = workflow_id; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), workflow_id=crate::apis::urlencode(p_path_workflow_id)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn actions_get_workflow(configuration: &configuration::Configuration, owner: &str, repo: &str, workflow_id: &str) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_workflow_id = workflow_id; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/workflows/{workflow_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), workflow_id=crate::apis::urlencode(p_path_workflow_id)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflow`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflow`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn actions_list_repository_workflows(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/workflows", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn create_current_user_repo(configuration: &configuration::Configuration, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/repos", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/user/repos", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn create_fork(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/forks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/forks", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn create_repo_variable(configuration: &configuration::Configuration, owner: &str, repo: &str, variablename: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_variablename = variablename; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/actions/variables/{variablename}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), variablename=crate::apis::urlencode(p_path_variablename)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/actions/variables/{variablename}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), variablename=crate::apis::urlencode(variablename)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn delete_action_run(configuration: &configuration::Configuration, owner: &str, repo: &str, run: i32) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_run = run; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/runs/{run}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), run=p_path_run); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn delete_artifact(configuration: &configuration::Configuration, owner: &str, repo: &str, artifact_id: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_artifact_id = artifact_id; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/artifacts/{artifact_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), artifact_id=crate::apis::urlencode(p_path_artifact_id)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn delete_repo_runner(configuration: &configuration::Configuration, owner: &str, repo: &str, runner_id: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_runner_id = runner_id; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/runners/{runner_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), runner_id=crate::apis::urlencode(p_path_runner_id)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn delete_repo_secret(configuration: &configuration::Configuration, owner: &str, repo: &str, secretname: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_secretname = secretname; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/actions/secrets/{secretname}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), secretname=crate::apis::urlencode(p_path_secretname)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/actions/secrets/{secretname}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), secretname=crate::apis::urlencode(secretname)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn delete_repo_variable(configuration: &configuration::Configuration, owner: &str, repo: &str, variablename: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_variablename = variablename; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/actions/variables/{variablename}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), variablename=crate::apis::urlencode(p_path_variablename)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/actions/variables/{variablename}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), variablename=crate::apis::urlencode(variablename)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionVariable`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionVariable`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn download_actions_run_job_logs(configuration: &configuration::Configuration, owner: &str, repo: &str, job_id: i32) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_job_id = job_id; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/jobs/{job_id}/logs", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), job_id=p_path_job_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn download_artifact(configuration: &configuration::Configuration, owner: &str, repo: &str, artifact_id: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_artifact_id = artifact_id; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/artifacts/{artifact_id}/zip", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), artifact_id=crate::apis::urlencode(p_path_artifact_id)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn generate_repo(configuration: &configuration::Configuration, template_owner: &str, template_repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_template_owner = template_owner; + let p_path_template_repo = template_repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{template_owner}/{template_repo}/generate", configuration.base_path, template_owner=crate::apis::urlencode(p_path_template_owner), template_repo=crate::apis::urlencode(p_path_template_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{template_owner}/{template_repo}/generate", local_var_configuration.base_path, template_owner=crate::apis::urlencode(template_owner), template_repo=crate::apis::urlencode(template_repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_annotated_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_sha = sha; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/git/tags/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/tags/{sha}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), sha=crate::apis::urlencode(sha)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AnnotatedTag`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AnnotatedTag`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_artifact(configuration: &configuration::Configuration, owner: &str, repo: &str, artifact_id: &str) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_artifact_id = artifact_id; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/artifacts/{artifact_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), artifact_id=crate::apis::urlencode(p_path_artifact_id)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionArtifact`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionArtifact`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_artifacts(configuration: &configuration::Configuration, owner: &str, repo: &str, name: Option<&str>) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_name = name; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/artifacts", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_name { + req_builder = req_builder.query(&[("name", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionArtifactsResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionArtifactsResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_artifacts_of_run(configuration: &configuration::Configuration, owner: &str, repo: &str, run: i32, name: Option<&str>) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_run = run; + let p_query_name = name; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/runs/{run}/artifacts", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), run=p_path_run); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_name { + req_builder = req_builder.query(&[("name", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionArtifactsResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionArtifactsResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_blob(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_sha = sha; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/git/blobs/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/blobs/{sha}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), sha=crate::apis::urlencode(sha)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GitBlobResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GitBlobResponse`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_repo_runner(configuration: &configuration::Configuration, owner: &str, repo: &str, runner_id: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_runner_id = runner_id; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/runners/{runner_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), runner_id=crate::apis::urlencode(p_path_runner_id)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_repo_runners(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/runners", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_repo_variable(configuration: &configuration::Configuration, owner: &str, repo: &str, variablename: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_variablename = variablename; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/actions/variables/{variablename}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), variablename=crate::apis::urlencode(p_path_variablename)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/actions/variables/{variablename}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), variablename=crate::apis::urlencode(variablename)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionVariable`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionVariable`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_repo_variables_list(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/actions/variables", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/actions/variables", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ActionVariable>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ActionVariable>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_tree(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str, recursive: Option, page: Option, per_page: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_sha = sha; + let p_query_recursive = recursive; + let p_query_page = page; + let p_query_per_page = per_page; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/git/trees/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/trees/{sha}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), sha=crate::apis::urlencode(sha)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = recursive { - local_var_req_builder = local_var_req_builder.query(&[("recursive", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_recursive { + req_builder = req_builder.query(&[("recursive", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = per_page { - local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_per_page { + req_builder = req_builder.query(&[("per_page", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GitTreeResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GitTreeResponse`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_workflow_job(configuration: &configuration::Configuration, owner: &str, repo: &str, job_id: &str) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_job_id = job_id; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/jobs/{job_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), job_id=crate::apis::urlencode(p_path_job_id)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowJob`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowJob`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_workflow_run(configuration: &configuration::Configuration, owner: &str, repo: &str, run: &str) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_run = run; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/runs/{run}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), run=crate::apis::urlencode(p_path_run)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowRun`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowRun`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_workflow_runs(configuration: &configuration::Configuration, owner: &str, repo: &str, event: Option<&str>, branch: Option<&str>, status: Option<&str>, actor: Option<&str>, head_sha: Option<&str>, page: Option, limit: Option) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_event = event; + let p_query_branch = branch; + let p_query_status = status; + let p_query_actor = actor; + let p_query_head_sha = head_sha; + let p_query_page = page; + let p_query_limit = limit; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/runs", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_event { + req_builder = req_builder.query(&[("event", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_branch { + req_builder = req_builder.query(&[("branch", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_status { + req_builder = req_builder.query(&[("status", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_actor { + req_builder = req_builder.query(&[("actor", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_head_sha { + req_builder = req_builder.query(&[("head_sha", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowRunsResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowRunsResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn list_action_tasks(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/tasks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionTaskResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionTaskResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn list_forks(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/forks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/forks", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Repository>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Repository>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn list_workflow_jobs(configuration: &configuration::Configuration, owner: &str, repo: &str, status: Option<&str>, page: Option, limit: Option) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_status = status; + let p_query_page = page; + let p_query_limit = limit; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/jobs", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_status { + req_builder = req_builder.query(&[("status", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn list_workflow_run_jobs(configuration: &configuration::Configuration, owner: &str, repo: &str, run: i32, status: Option<&str>, page: Option, limit: Option) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_run = run; + let p_query_status = status; + let p_query_page = page; + let p_query_limit = limit; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/runs/{run}/jobs", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), run=p_path_run); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_status { + req_builder = req_builder.query(&[("status", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn reject_repo_transfer(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/transfer/reject", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/transfer/reject", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_add_collaborator(configuration: &configuration::Configuration, owner: &str, repo: &str, collaborator: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_collaborator = collaborator; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/collaborators/{collaborator}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), collaborator=crate::apis::urlencode(p_path_collaborator)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/collaborators/{collaborator}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), collaborator=crate::apis::urlencode(collaborator)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_add_push_mirror(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PushMirror`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PushMirror`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_add_team(configuration: &configuration::Configuration, owner: &str, repo: &str, team: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_team = team; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/teams/{team}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), team=crate::apis::urlencode(p_path_team)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/teams/{team}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), team=crate::apis::urlencode(team)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_add_topic(configuration: &configuration::Configuration, owner: &str, repo: &str, topic: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_topic = topic; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/topics/{topic}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), topic=crate::apis::urlencode(p_path_topic)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/topics/{topic}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), topic=crate::apis::urlencode(topic)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } -pub async fn repo_apply_diff_patch(configuration: &configuration::Configuration, owner: &str, repo: &str, body: models::UpdateFileOptions) -> Result> { - let local_var_configuration = configuration; +pub async fn repo_apply_diff_patch(configuration: &configuration::Configuration, owner: &str, repo: &str, body: models::ApplyDiffPatchFileOptions) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/diffpatch", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/diffpatch", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FileResponse`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_cancel_scheduled_auto_merge(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/merge", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/merge", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_change_files(configuration: &configuration::Configuration, owner: &str, repo: &str, body: models::ChangeFilesOptions) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/contents", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/contents", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FilesResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FilesResponse`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_check_collaborator(configuration: &configuration::Configuration, owner: &str, repo: &str, collaborator: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_collaborator = collaborator; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/collaborators/{collaborator}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), collaborator=crate::apis::urlencode(p_path_collaborator)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/collaborators/{collaborator}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), collaborator=crate::apis::urlencode(collaborator)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_check_team(configuration: &configuration::Configuration, owner: &str, repo: &str, team: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_team = team; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/teams/{team}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), team=crate::apis::urlencode(p_path_team)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/teams/{team}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), team=crate::apis::urlencode(team)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Team`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Team`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_compare_diff(configuration: &configuration::Configuration, owner: &str, repo: &str, basehead: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_basehead = basehead; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/compare/{basehead}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), basehead=crate::apis::urlencode(p_path_basehead)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/compare/{basehead}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), basehead=crate::apis::urlencode(basehead)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Compare`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Compare`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_create_branch(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/branches", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/branches", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Branch`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Branch`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_create_branch_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/branch_protections", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/branch_protections", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BranchProtection`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BranchProtection`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_create_file(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, body: models::CreateFileOptions) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_filepath = filepath; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/contents/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/contents/{filepath}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), filepath=crate::apis::urlencode(filepath)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FileResponse`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_create_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/hooks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/hooks", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_create_key(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/keys", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/keys", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeployKey`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeployKey`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_create_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullRequest`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullRequest`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_create_pull_review(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: models::CreatePullReviewOptions) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullReview`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullReview`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_create_pull_review_requests(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: models::PullReviewRequestOptions) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/requested_reviewers", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/requested_reviewers", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullReview>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PullReview>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_create_release(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/releases", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Release`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Release`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_create_release_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, name: Option<&str>, attachment: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_query_name = name; + let p_form_attachment = attachment; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = name { - local_var_req_builder = local_var_req_builder.query(&[("name", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_name { + req_builder = req_builder.query(&[("name", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let mut local_var_form = reqwest::multipart::Form::new(); - // TODO: support file upload for 'attachment' parameter - local_var_req_builder = local_var_req_builder.multipart(local_var_form); + let mut multipart_form = reqwest::multipart::Form::new(); + if let Some(ref param_value) = p_form_attachment { + let file = TokioFile::open(param_value).await?; + let stream = FramedRead::new(file, BytesCodec::new()); + let file_name = param_value.file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_default(); + let file_part = reqwest::multipart::Part::stream(reqwest::Body::wrap_stream(stream)).file_name(file_name); + multipart_form = multipart_form.part("attachment", file_part); + } + req_builder = req_builder.multipart(multipart_form); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Attachment`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn repo_create_runner_registration_token(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + + let uri_str = format!("{}/repos/{owner}/{repo}/actions/runners/registration-token", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_create_status(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_sha = sha; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/statuses/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/statuses/{sha}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), sha=crate::apis::urlencode(sha)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CommitStatus`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CommitStatus`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_create_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/tags", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/tags", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Tag`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Tag`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn repo_create_tag_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; + + let uri_str = format!("{}/repos/{owner}/{repo}/tag_protections", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + req_builder = req_builder.json(&p_body_body); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TagProtection`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TagProtection`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_create_wiki_page(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/wiki/new", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/wiki/new", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WikiPage`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WikiPage`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_avatar(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/avatar", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/avatar", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_branch(configuration: &configuration::Configuration, owner: &str, repo: &str, branch: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_branch = branch; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/branches/{branch}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), branch=crate::apis::urlencode(p_path_branch)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/branches/{branch}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), branch=crate::apis::urlencode(branch)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_branch_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, name: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_name = name; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/branch_protections/{name}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), name=crate::apis::urlencode(p_path_name)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/branch_protections/{name}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_collaborator(configuration: &configuration::Configuration, owner: &str, repo: &str, collaborator: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_collaborator = collaborator; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/collaborators/{collaborator}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), collaborator=crate::apis::urlencode(p_path_collaborator)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/collaborators/{collaborator}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), collaborator=crate::apis::urlencode(collaborator)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_file(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, body: models::DeleteFileOptions) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_filepath = filepath; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/contents/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/contents/{filepath}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), filepath=crate::apis::urlencode(filepath)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileDeleteResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FileDeleteResponse`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_git_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/hooks/git/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=crate::apis::urlencode(p_path_id)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/hooks/git/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=crate::apis::urlencode(id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/hooks/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/hooks/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_key(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/keys/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/keys/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_pull_review(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_pull_review_requests(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: models::PullReviewRequestOptions) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/requested_reviewers", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/requested_reviewers", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_push_mirror(configuration: &configuration::Configuration, owner: &str, repo: &str, name: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_name = name; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors/{name}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), name=crate::apis::urlencode(p_path_name)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors/{name}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_release(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_release_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment_id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_path_attachment_id = attachment_id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id, attachment_id=p_path_attachment_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id, attachment_id=attachment_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_release_by_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, tag: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_tag = tag; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/releases/tags/{tag}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), tag=crate::apis::urlencode(p_path_tag)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/tags/{tag}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), tag=crate::apis::urlencode(tag)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, tag: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_tag = tag; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/tags/{tag}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), tag=crate::apis::urlencode(p_path_tag)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/tags/{tag}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), tag=crate::apis::urlencode(tag)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn repo_delete_tag_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i32) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + + let uri_str = format!("{}/repos/{owner}/{repo}/tag_protections/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_team(configuration: &configuration::Configuration, owner: &str, repo: &str, team: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_team = team; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/teams/{team}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), team=crate::apis::urlencode(p_path_team)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/teams/{team}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), team=crate::apis::urlencode(team)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_topic(configuration: &configuration::Configuration, owner: &str, repo: &str, topic: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_topic = topic; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/topics/{topic}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), topic=crate::apis::urlencode(p_path_topic)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/topics/{topic}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), topic=crate::apis::urlencode(topic)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_delete_wiki_page(configuration: &configuration::Configuration, owner: &str, repo: &str, page_name: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_page_name = page_name; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/wiki/page/{pageName}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), pageName=crate::apis::urlencode(p_path_page_name)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/wiki/page/{pageName}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), pageName=crate::apis::urlencode(page_name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_dismiss_pull_review(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64, body: models::DismissPullReviewOptions) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/dismissals", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/dismissals", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullReview`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullReview`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_download_commit_diff_or_patch(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str, diff_type: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_sha = sha; + let p_path_diff_type = diff_type; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/git/commits/{sha}.{diffType}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha), diffType=crate::apis::urlencode(p_path_diff_type)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/commits/{sha}.{diffType}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), sha=crate::apis::urlencode(sha), diffType=crate::apis::urlencode(diff_type)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Ok(content), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_download_pull_diff_or_patch(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, diff_type: &str, binary: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_diff_type = diff_type; + let p_query_binary = binary; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}.{diffType}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, diffType=crate::apis::urlencode(p_path_diff_type)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}.{diffType}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, diffType=crate::apis::urlencode(diff_type)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = binary { - local_var_req_builder = local_var_req_builder.query(&[("binary", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_binary { + req_builder = req_builder.query(&[("binary", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Ok(content), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_edit(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_edit_branch_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, name: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_name = name; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/branch_protections/{name}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), name=crate::apis::urlencode(p_path_name)); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/branch_protections/{name}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BranchProtection`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BranchProtection`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_edit_git_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/hooks/git/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=crate::apis::urlencode(p_path_id)); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/hooks/git/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=crate::apis::urlencode(id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GitHook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GitHook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_edit_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/hooks/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/hooks/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_edit_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullRequest`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullRequest`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_edit_release(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Release`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Release`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_edit_release_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment_id: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_path_attachment_id = attachment_id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id, attachment_id=p_path_attachment_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id, attachment_id=attachment_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Attachment`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn repo_edit_tag_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i32, body: Option) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_body_body = body; + + let uri_str = format!("{}/repos/{owner}/{repo}/tag_protections/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + req_builder = req_builder.json(&p_body_body); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TagProtection`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TagProtection`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_edit_wiki_page(configuration: &configuration::Configuration, owner: &str, repo: &str, page_name: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_page_name = page_name; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/wiki/page/{pageName}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), pageName=crate::apis::urlencode(p_path_page_name)); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/wiki/page/{pageName}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), pageName=crate::apis::urlencode(page_name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WikiPage`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WikiPage`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } -pub async fn repo_get_all_commits(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: Option<&str>, path: Option<&str>, stat: Option, verification: Option, files: Option, page: Option, limit: Option, not: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; +pub async fn repo_get_all_commits(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: Option<&str>, path: Option<&str>, since: Option, until: Option, stat: Option, verification: Option, files: Option, page: Option, limit: Option, not: Option<&str>) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_sha = sha; + let p_query_path = path; + let p_query_since = since; + let p_query_until = until; + let p_query_stat = stat; + let p_query_verification = verification; + let p_query_files = files; + let p_query_page = page; + let p_query_limit = limit; + let p_query_not = not; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/commits", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/commits", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = sha { - local_var_req_builder = local_var_req_builder.query(&[("sha", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_sha { + req_builder = req_builder.query(&[("sha", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = path { - local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_path { + req_builder = req_builder.query(&[("path", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = stat { - local_var_req_builder = local_var_req_builder.query(&[("stat", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_since { + req_builder = req_builder.query(&[("since", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = verification { - local_var_req_builder = local_var_req_builder.query(&[("verification", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_until { + req_builder = req_builder.query(&[("until", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = files { - local_var_req_builder = local_var_req_builder.query(&[("files", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_stat { + req_builder = req_builder.query(&[("stat", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_verification { + req_builder = req_builder.query(&[("verification", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_files { + req_builder = req_builder.query(&[("files", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = not { - local_var_req_builder = local_var_req_builder.query(&[("not", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_not { + req_builder = req_builder.query(&[("not", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Commit>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Commit>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_archive(configuration: &configuration::Configuration, owner: &str, repo: &str, archive: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_archive = archive; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/archive/{archive}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), archive=crate::apis::urlencode(p_path_archive)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/archive/{archive}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), archive=crate::apis::urlencode(archive)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_assignees(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/assignees", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/assignees", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_branch(configuration: &configuration::Configuration, owner: &str, repo: &str, branch: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_branch = branch; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/branches/{branch}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), branch=crate::apis::urlencode(p_path_branch)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/branches/{branch}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), branch=crate::apis::urlencode(branch)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Branch`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Branch`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_branch_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, name: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_name = name; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/branch_protections/{name}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), name=crate::apis::urlencode(p_path_name)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/branch_protections/{name}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BranchProtection`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BranchProtection`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_by_id(configuration: &configuration::Configuration, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repositories/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repositories/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_combined_status_by_ref(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: &str, page: Option, limit: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_ref = r#ref; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/commits/{ref}/status", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), ref=crate::apis::urlencode(p_path_ref)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/commits/{ref}/status", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), ref=crate::apis::urlencode(r#ref)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CombinedStatus`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CombinedStatus`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_commit_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_sha = sha; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/commits/{sha}/pull", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/commits/{sha}/pull", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), sha=crate::apis::urlencode(sha)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullRequest`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullRequest`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } +/// This API follows GitHub's design, and it is not easy to use. Recommend users to use the \"contents-ext\" API instead. pub async fn repo_get_contents(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, r#ref: Option<&str>) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_filepath = filepath; + let p_query_ref = r#ref; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/contents/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/contents/{filepath}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), filepath=crate::apis::urlencode(filepath)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = r#ref { - local_var_req_builder = local_var_req_builder.query(&[("ref", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_ref { + req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ContentsResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ContentsResponse`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } -pub async fn repo_get_contents_list(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; +/// It guarantees that only one of the response fields is set if the request succeeds. Users can pass \"includes=file_content\" or \"includes=lfs_metadata\" to retrieve more fields. \"includes=file_content\" only works for single file, if you need to retrieve file contents in batch, use \"file-contents\" API after listing the directory. +pub async fn repo_get_contents_ext(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, r#ref: Option<&str>, includes: Option<&str>) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_filepath = filepath; + let p_query_ref = r#ref; + let p_query_includes = includes; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/contents-ext/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/contents", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = r#ref { - local_var_req_builder = local_var_req_builder.query(&[("ref", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_ref { + req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref param_value) = p_query_includes { + req_builder = req_builder.query(&[("includes", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ContentsExtResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ContentsExtResponse`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +/// This API follows GitHub's design, and it is not easy to use. Recommend users to use our \"contents-ext\" API instead. +pub async fn repo_get_contents_list(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: Option<&str>) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_ref = r#ref; + + let uri_str = format!("{}/repos/{owner}/{repo}/contents", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_ref { + req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ContentsResponse>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ContentsResponse>`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_editor_config(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, r#ref: Option<&str>) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_filepath = filepath; + let p_query_ref = r#ref; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/editorconfig/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/editorconfig/{filepath}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), filepath=crate::apis::urlencode(filepath)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = r#ref { - local_var_req_builder = local_var_req_builder.query(&[("ref", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_ref { + req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +/// See the POST method. This GET method supports using JSON encoded request body in query parameter. +pub async fn repo_get_file_contents(configuration: &configuration::Configuration, owner: &str, repo: &str, body: &str, r#ref: Option<&str>) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_body = body; + let p_query_ref = r#ref; + + let uri_str = format!("{}/repos/{owner}/{repo}/file-contents", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_ref { + req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]); + } + req_builder = req_builder.query(&[("body", &p_query_body.to_string())]); + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ContentsResponse>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ContentsResponse>`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +/// Uses automatic pagination based on default page size and max response size and returns the maximum allowed number of files. Files which could not be retrieved are null. Files which are too large are being returned with `encoding == null`, `content == null` and `size > 0`, they can be requested separately by using the `download_url`. +pub async fn repo_get_file_contents_post(configuration: &configuration::Configuration, owner: &str, repo: &str, body: models::GetFilesOptions, r#ref: Option<&str>) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; + let p_query_ref = r#ref; + + let uri_str = format!("{}/repos/{owner}/{repo}/file-contents", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref param_value) = p_query_ref { + req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + req_builder = req_builder.json(&p_body_body); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ContentsResponse>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ContentsResponse>`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_git_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/hooks/git/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=crate::apis::urlencode(p_path_id)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/hooks/git/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=crate::apis::urlencode(id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GitHook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GitHook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/hooks/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/hooks/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_issue_config(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issue_config", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issue_config", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssueConfig`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IssueConfig`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_issue_templates(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issue_templates", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issue_templates", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::IssueTemplate>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::IssueTemplate>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_key(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/keys/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/keys/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeployKey`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeployKey`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_languages(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/languages", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/languages", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, i64>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, i64>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_latest_release(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/releases/latest", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/latest", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Release`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Release`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn repo_get_licenses(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + + let uri_str = format!("{}/repos/{owner}/{repo}/licenses", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<String>`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_note(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str, verification: Option, files: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_sha = sha; + let p_query_verification = verification; + let p_query_files = files; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/git/notes/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/notes/{sha}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), sha=crate::apis::urlencode(sha)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = verification { - local_var_req_builder = local_var_req_builder.query(&[("verification", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_verification { + req_builder = req_builder.query(&[("verification", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = files { - local_var_req_builder = local_var_req_builder.query(&[("files", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_files { + req_builder = req_builder.query(&[("files", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Note`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Note`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullRequest`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullRequest`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_pull_request_by_base_head(configuration: &configuration::Configuration, owner: &str, repo: &str, base: &str, head: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_base = base; + let p_path_head = head; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{base}/{head}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), base=crate::apis::urlencode(p_path_base), head=crate::apis::urlencode(p_path_head)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{base}/{head}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), base=crate::apis::urlencode(base), head=crate::apis::urlencode(head)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullRequest`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullRequest`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_pull_request_commits(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, page: Option, limit: Option, verification: Option, files: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_query_page = page; + let p_query_limit = limit; + let p_query_verification = verification; + let p_query_files = files; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/commits", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/commits", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = verification { - local_var_req_builder = local_var_req_builder.query(&[("verification", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_verification { + req_builder = req_builder.query(&[("verification", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = files { - local_var_req_builder = local_var_req_builder.query(&[("files", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_files { + req_builder = req_builder.query(&[("files", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Commit>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Commit>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_pull_request_files(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, skip_to: Option<&str>, whitespace: Option<&str>, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_query_skip_to = skip_to; + let p_query_whitespace = whitespace; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/files", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/files", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = skip_to { - local_var_req_builder = local_var_req_builder.query(&[("skip-to", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_skip_to { + req_builder = req_builder.query(&[("skip-to", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = whitespace { - local_var_req_builder = local_var_req_builder.query(&[("whitespace", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_whitespace { + req_builder = req_builder.query(&[("whitespace", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ChangedFile>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ChangedFile>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_pull_review(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullReview`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullReview`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_pull_review_comments(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/comments", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/comments", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullReviewComment>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PullReviewComment>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_push_mirror_by_remote_name(configuration: &configuration::Configuration, owner: &str, repo: &str, name: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_name = name; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors/{name}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), name=crate::apis::urlencode(p_path_name)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors/{name}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), name=crate::apis::urlencode(name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PushMirror`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PushMirror`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } -pub async fn repo_get_raw_file(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, r#ref: Option<&str>) -> Result<(), Error> { - let local_var_configuration = configuration; +pub async fn repo_get_raw_file(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, r#ref: Option<&str>) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_filepath = filepath; + let p_query_ref = r#ref; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/raw/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/raw/{filepath}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), filepath=crate::apis::urlencode(filepath)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = r#ref { - local_var_req_builder = local_var_req_builder.query(&[("ref", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_ref { + req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) + if !status.is_client_error() && !status.is_server_error() { + Ok(resp) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } -pub async fn repo_get_raw_file_or_lfs(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, r#ref: Option<&str>) -> Result<(), Error> { - let local_var_configuration = configuration; +pub async fn repo_get_raw_file_or_lfs(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, r#ref: Option<&str>) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_filepath = filepath; + let p_query_ref = r#ref; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/media/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/media/{filepath}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), filepath=crate::apis::urlencode(filepath)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = r#ref { - local_var_req_builder = local_var_req_builder.query(&[("ref", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_ref { + req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) + if !status.is_client_error() && !status.is_server_error() { + Ok(resp) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_release(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Release`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Release`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_release_attachment(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, attachment_id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_path_attachment_id = attachment_id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id, attachment_id=p_path_attachment_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id, attachment_id=attachment_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Attachment`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Attachment`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_release_by_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, tag: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_tag = tag; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/releases/tags/{tag}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), tag=crate::apis::urlencode(p_path_tag)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/tags/{tag}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), tag=crate::apis::urlencode(tag)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Release`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Release`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_repo_permissions(configuration: &configuration::Configuration, owner: &str, repo: &str, collaborator: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_collaborator = collaborator; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/collaborators/{collaborator}/permission", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), collaborator=crate::apis::urlencode(p_path_collaborator)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/collaborators/{collaborator}/permission", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), collaborator=crate::apis::urlencode(collaborator)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RepoCollaboratorPermission`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RepoCollaboratorPermission`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_reviewers(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/reviewers", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/reviewers", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_runner_registration_token(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/actions/runners/registration-token", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/runners/registration-token", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_single_commit(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str, stat: Option, verification: Option, files: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_sha = sha; + let p_query_stat = stat; + let p_query_verification = verification; + let p_query_files = files; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/git/commits/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/commits/{sha}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), sha=crate::apis::urlencode(sha)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = stat { - local_var_req_builder = local_var_req_builder.query(&[("stat", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_stat { + req_builder = req_builder.query(&[("stat", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = verification { - local_var_req_builder = local_var_req_builder.query(&[("verification", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_verification { + req_builder = req_builder.query(&[("verification", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = files { - local_var_req_builder = local_var_req_builder.query(&[("files", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_files { + req_builder = req_builder.query(&[("files", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Commit`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Commit`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, tag: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_tag = tag; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/tags/{tag}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), tag=crate::apis::urlencode(p_path_tag)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/tags/{tag}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), tag=crate::apis::urlencode(tag)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Tag`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Tag`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn repo_get_tag_protection(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i32) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + + let uri_str = format!("{}/repos/{owner}/{repo}/tag_protections/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TagProtection`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TagProtection`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_wiki_page(configuration: &configuration::Configuration, owner: &str, repo: &str, page_name: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_page_name = page_name; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/wiki/page/{pageName}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), pageName=crate::apis::urlencode(p_path_page_name)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/wiki/page/{pageName}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), pageName=crate::apis::urlencode(page_name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WikiPage`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WikiPage`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_wiki_page_revisions(configuration: &configuration::Configuration, owner: &str, repo: &str, page_name: &str, page: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_page_name = page_name; + let p_query_page = page; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/wiki/revisions/{pageName}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), pageName=crate::apis::urlencode(p_path_page_name)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/wiki/revisions/{pageName}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), pageName=crate::apis::urlencode(page_name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WikiCommitList`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WikiCommitList`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_get_wiki_pages(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/wiki/pages", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/wiki/pages", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::WikiPageMetaData>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::WikiPageMetaData>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_actions_secrets(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/actions/secrets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/actions/secrets", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Secret>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Secret>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_activity_feeds(configuration: &configuration::Configuration, owner: &str, repo: &str, date: Option, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_date = date; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/activities/feeds", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/activities/feeds", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = date { - local_var_req_builder = local_var_req_builder.query(&[("date", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_date { + req_builder = req_builder.query(&[("date", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Activity>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Activity>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_all_git_refs(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/git/refs", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/refs", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Reference>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Reference>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_branch_protection(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/branch_protections", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/branch_protections", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::BranchProtection>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::BranchProtection>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_branches(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/branches", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/branches", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Branch>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Branch>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_collaborators(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/collaborators", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/collaborators", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_git_hooks(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/hooks/git", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/hooks/git", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GitHook>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GitHook>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_git_refs(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_ref = r#ref; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/git/refs/{ref}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), ref=crate::apis::urlencode(p_path_ref)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/refs/{ref}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), ref=crate::apis::urlencode(r#ref)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Reference>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Reference>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_hooks(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/hooks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/hooks", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Hook>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Hook>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_keys(configuration: &configuration::Configuration, owner: &str, repo: &str, key_id: Option, fingerprint: Option<&str>, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_key_id = key_id; + let p_query_fingerprint = fingerprint; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/keys", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/keys", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = key_id { - local_var_req_builder = local_var_req_builder.query(&[("key_id", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_key_id { + req_builder = req_builder.query(&[("key_id", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = fingerprint { - local_var_req_builder = local_var_req_builder.query(&[("fingerprint", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_fingerprint { + req_builder = req_builder.query(&[("fingerprint", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::DeployKey>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::DeployKey>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_pinned_issues(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issues/pinned", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issues/pinned", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Issue>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Issue>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_pinned_pull_requests(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/pinned", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/pinned", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullRequest>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PullRequest>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } -pub async fn repo_list_pull_requests(configuration: &configuration::Configuration, owner: &str, repo: &str, state: Option<&str>, sort: Option<&str>, milestone: Option, labels: Option>, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; +pub async fn repo_list_pull_requests(configuration: &configuration::Configuration, owner: &str, repo: &str, base_branch: Option<&str>, state: Option<&str>, sort: Option<&str>, milestone: Option, labels: Option>, poster: Option<&str>, page: Option, limit: Option) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_base_branch = base_branch; + let p_query_state = state; + let p_query_sort = sort; + let p_query_milestone = milestone; + let p_query_labels = labels; + let p_query_poster = poster; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = state { - local_var_req_builder = local_var_req_builder.query(&[("state", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_base_branch { + req_builder = req_builder.query(&[("base_branch", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = sort { - local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_state { + req_builder = req_builder.query(&[("state", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = milestone { - local_var_req_builder = local_var_req_builder.query(&[("milestone", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_sort { + req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = labels { - local_var_req_builder = match "multi" { - "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("labels".to_owned(), p.to_string())).collect::>()), - _ => local_var_req_builder.query(&[("labels", &local_var_str.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), + if let Some(ref param_value) = p_query_milestone { + req_builder = req_builder.query(&[("milestone", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_labels { + req_builder = match "multi" { + "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("labels".to_owned(), p.to_string())).collect::>()), + _ => req_builder.query(&[("labels", ¶m_value.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]), }; } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_poster { + req_builder = req_builder.query(&[("poster", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullRequest>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PullRequest>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_pull_reviews(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullReview>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PullReview>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_push_mirrors(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PushMirror>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PushMirror>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_release_attachments(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases/{id}/assets", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Attachment>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Attachment>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_releases(configuration: &configuration::Configuration, owner: &str, repo: &str, draft: Option, pre_release: Option, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_draft = draft; + let p_query_pre_release = pre_release; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/releases", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/releases", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = draft { - local_var_req_builder = local_var_req_builder.query(&[("draft", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_draft { + req_builder = req_builder.query(&[("draft", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = pre_release { - local_var_req_builder = local_var_req_builder.query(&[("pre-release", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_pre_release { + req_builder = req_builder.query(&[("pre-release", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Release>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Release>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_stargazers(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/stargazers", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/stargazers", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_statuses(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str, sort: Option<&str>, state: Option<&str>, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_sha = sha; + let p_query_sort = sort; + let p_query_state = state; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/statuses/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/statuses/{sha}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), sha=crate::apis::urlencode(sha)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = sort { - local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_sort { + req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = state { - local_var_req_builder = local_var_req_builder.query(&[("state", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_state { + req_builder = req_builder.query(&[("state", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::CommitStatus>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::CommitStatus>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_statuses_by_ref(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: &str, sort: Option<&str>, state: Option<&str>, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_ref = r#ref; + let p_query_sort = sort; + let p_query_state = state; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/commits/{ref}/statuses", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), ref=crate::apis::urlencode(p_path_ref)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/commits/{ref}/statuses", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), ref=crate::apis::urlencode(r#ref)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = sort { - local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_sort { + req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = state { - local_var_req_builder = local_var_req_builder.query(&[("state", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_state { + req_builder = req_builder.query(&[("state", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::CommitStatus>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::CommitStatus>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_subscribers(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/subscribers", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/subscribers", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn repo_list_tag_protection(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + + let uri_str = format!("{}/repos/{owner}/{repo}/tag_protections", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TagProtection>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::TagProtection>`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_tags(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/tags", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/tags", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Tag>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Tag>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_teams(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/teams", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/teams", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Team>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Team>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_list_topics(configuration: &configuration::Configuration, owner: &str, repo: &str, page: Option, limit: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/topics", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/topics", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TopicName`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TopicName`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_merge_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/merge", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/merge", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn repo_merge_upstream(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; + + let uri_str = format!("{}/repos/{owner}/{repo}/merge-upstream", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + req_builder = req_builder.json(&p_body_body); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MergeUpstreamResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::MergeUpstreamResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_migrate(configuration: &configuration::Configuration, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/migrate", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/migrate", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_mirror_sync(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/mirror-sync", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/mirror-sync", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_new_pin_allowed(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/new_pin_allowed", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/new_pin_allowed", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NewIssuePinsAllowed`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NewIssuePinsAllowed`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_pull_request_is_merged(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/merge", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/merge", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_push_mirror_sync(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors-sync", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/push_mirrors-sync", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn repo_rename_branch(configuration: &configuration::Configuration, owner: &str, repo: &str, branch: &str, body: Option) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_branch = branch; + let p_body_body = body; + + let uri_str = format!("{}/repos/{owner}/{repo}/branches/{branch}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), branch=crate::apis::urlencode(p_path_branch)); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + req_builder = req_builder.json(&p_body_body); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_search(configuration: &configuration::Configuration, q: Option<&str>, topic: Option, include_desc: Option, uid: Option, priority_owner_id: Option, team_id: Option, starred_by: Option, private: Option, is_private: Option, template: Option, archived: Option, mode: Option<&str>, exclusive: Option, sort: Option<&str>, order: Option<&str>, page: Option, limit: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_q = q; + let p_query_topic = topic; + let p_query_include_desc = include_desc; + let p_query_uid = uid; + let p_query_priority_owner_id = priority_owner_id; + let p_query_team_id = team_id; + let p_query_starred_by = starred_by; + let p_query_private = private; + let p_query_is_private = is_private; + let p_query_template = template; + let p_query_archived = archived; + let p_query_mode = mode; + let p_query_exclusive = exclusive; + let p_query_sort = sort; + let p_query_order = order; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/search", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/search", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = q { - local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_q { + req_builder = req_builder.query(&[("q", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = topic { - local_var_req_builder = local_var_req_builder.query(&[("topic", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_topic { + req_builder = req_builder.query(&[("topic", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = include_desc { - local_var_req_builder = local_var_req_builder.query(&[("includeDesc", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_include_desc { + req_builder = req_builder.query(&[("includeDesc", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = uid { - local_var_req_builder = local_var_req_builder.query(&[("uid", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_uid { + req_builder = req_builder.query(&[("uid", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = priority_owner_id { - local_var_req_builder = local_var_req_builder.query(&[("priority_owner_id", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_priority_owner_id { + req_builder = req_builder.query(&[("priority_owner_id", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = team_id { - local_var_req_builder = local_var_req_builder.query(&[("team_id", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_team_id { + req_builder = req_builder.query(&[("team_id", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = starred_by { - local_var_req_builder = local_var_req_builder.query(&[("starredBy", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_starred_by { + req_builder = req_builder.query(&[("starredBy", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = private { - local_var_req_builder = local_var_req_builder.query(&[("private", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_private { + req_builder = req_builder.query(&[("private", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = is_private { - local_var_req_builder = local_var_req_builder.query(&[("is_private", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_is_private { + req_builder = req_builder.query(&[("is_private", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = template { - local_var_req_builder = local_var_req_builder.query(&[("template", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_template { + req_builder = req_builder.query(&[("template", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = archived { - local_var_req_builder = local_var_req_builder.query(&[("archived", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_archived { + req_builder = req_builder.query(&[("archived", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = mode { - local_var_req_builder = local_var_req_builder.query(&[("mode", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_mode { + req_builder = req_builder.query(&[("mode", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = exclusive { - local_var_req_builder = local_var_req_builder.query(&[("exclusive", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_exclusive { + req_builder = req_builder.query(&[("exclusive", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = sort { - local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_sort { + req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = order { - local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_order { + req_builder = req_builder.query(&[("order", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SearchResults`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SearchResults`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_signing_key(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/signing-key.gpg", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/signing-key.gpg", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Ok(content), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn repo_signing_key_ssh(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + + let uri_str = format!("{}/repos/{owner}/{repo}/signing-key.pub", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Ok(content), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_submit_pull_review(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64, body: models::SubmitPullReviewOptions) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullReview`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullReview`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_test_hook(configuration: &configuration::Configuration, owner: &str, repo: &str, id: i64, r#ref: Option<&str>) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_id = id; + let p_query_ref = r#ref; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/hooks/{id}/tests", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/hooks/{id}/tests", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = r#ref { - local_var_req_builder = local_var_req_builder.query(&[("ref", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_ref { + req_builder = req_builder.query(&[("ref", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_tracked_times(configuration: &configuration::Configuration, owner: &str, repo: &str, user: Option<&str>, since: Option, before: Option, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_query_user = user; + let p_query_since = since; + let p_query_before = before; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/times", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/times", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = user { - local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_user { + req_builder = req_builder.query(&[("user", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = since { - local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_since { + req_builder = req_builder.query(&[("since", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = before { - local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_before { + req_builder = req_builder.query(&[("before", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TrackedTime>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::TrackedTime>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_transfer(configuration: &configuration::Configuration, owner: &str, repo: &str, body: models::TransferRepoOption) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/transfer", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/transfer", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_un_dismiss_pull_review(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/undismissals", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/undismissals", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullReview`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullReview`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_update_avatar(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/avatar", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/avatar", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn repo_update_branch_protection_priories(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; + + let uri_str = format!("{}/repos/{owner}/{repo}/branch_protections/priority", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + req_builder = req_builder.json(&p_body_body); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_update_file(configuration: &configuration::Configuration, owner: &str, repo: &str, filepath: &str, body: models::UpdateFileOptions) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_filepath = filepath; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/contents/{filepath}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), filepath=crate::apis::urlencode(p_path_filepath)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/contents/{filepath}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), filepath=crate::apis::urlencode(filepath)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FileResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FileResponse`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_update_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, index: i64, style: Option<&str>) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_index = index; + let p_query_style = style; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/update", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), index=p_path_index); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/pulls/{index}/update", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), index=index); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = style { - local_var_req_builder = local_var_req_builder.query(&[("style", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_style { + req_builder = req_builder.query(&[("style", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_update_topics(configuration: &configuration::Configuration, owner: &str, repo: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/topics", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/topics", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn repo_validate_issue_config(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/issue_config/validate", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/issue_config/validate", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssueConfigValidation`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IssueConfigValidation`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn topic_search(configuration: &configuration::Configuration, q: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_q = q; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/topics/search", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/topics/search", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - local_var_req_builder = local_var_req_builder.query(&[("q", &q.to_string())]); - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + req_builder = req_builder.query(&[("q", &p_query_q.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TopicResponse>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::TopicResponse>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn update_repo_secret(configuration: &configuration::Configuration, owner: &str, repo: &str, secretname: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_secretname = secretname; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/actions/secrets/{secretname}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), secretname=crate::apis::urlencode(p_path_secretname)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/actions/secrets/{secretname}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), secretname=crate::apis::urlencode(secretname)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn update_repo_variable(configuration: &configuration::Configuration, owner: &str, repo: &str, variablename: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_variablename = variablename; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/actions/variables/{variablename}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), variablename=crate::apis::urlencode(p_path_variablename)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/actions/variables/{variablename}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), variablename=crate::apis::urlencode(variablename)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_check_subscription(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/subscription", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/subscription", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WatchInfo`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WatchInfo`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_delete_subscription(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/subscription", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/subscription", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_put_subscription(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/subscription", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/subscription", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::WatchInfo`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::WatchInfo`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } +#[deprecated] pub async fn user_tracked_times(configuration: &configuration::Configuration, owner: &str, repo: &str, user: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; + let p_path_user = user; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/repos/{owner}/{repo}/times/{user}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), user=crate::apis::urlencode(p_path_user)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/repos/{owner}/{repo}/times/{user}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), user=crate::apis::urlencode(user)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TrackedTime>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::TrackedTime>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } diff --git a/crates/gitea-client/src/apis/settings_api.rs b/crates/gitea-client/src/apis/settings_api.rs index ad524d5..d36e1a4 100644 --- a/crates/gitea-client/src/apis/settings_api.rs +++ b/crates/gitea-client/src/apis/settings_api.rs @@ -3,16 +3,16 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ use reqwest; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; +use super::{Error, configuration, ContentType}; /// struct for typed errors of method [`get_general_api_settings`] @@ -45,314 +45,342 @@ pub enum GetGeneralUiSettingsError { pub async fn get_general_api_settings(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/settings/api", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/settings/api", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GeneralApiSettings`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GeneralApiSettings`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_general_attachment_settings(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/settings/attachment", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/settings/attachment", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GeneralAttachmentSettings`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GeneralAttachmentSettings`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_general_repository_settings(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/settings/repository", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/settings/repository", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GeneralRepoSettings`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GeneralRepoSettings`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_general_ui_settings(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/settings/ui", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/settings/ui", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GeneralUiSettings`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GeneralUiSettings`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } diff --git a/crates/gitea-client/src/apis/user_api.rs b/crates/gitea-client/src/apis/user_api.rs index bf2e4de..4cee394 100644 --- a/crates/gitea-client/src/apis/user_api.rs +++ b/crates/gitea-client/src/apis/user_api.rs @@ -3,16 +3,16 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ use reqwest; -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Error as _}; use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; +use super::{Error, configuration, ContentType}; /// struct for typed errors of method [`create_current_user_repo`] @@ -29,6 +29,15 @@ pub enum CreateCurrentUserRepoError { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum CreateUserVariableError { + Status400(), + Status409(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`delete_user_runner`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteUserRunnerError { Status400(), Status404(), UnknownValue(serde_json::Value), @@ -52,6 +61,24 @@ pub enum DeleteUserVariableError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_user_runner`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserRunnerError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_user_runners`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserRunnersError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`get_user_settings`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -77,6 +104,24 @@ pub enum GetUserVariablesListError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_user_workflow_jobs`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserWorkflowJobsError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_user_workflow_runs`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserWorkflowRunsError { + Status400(), + Status404(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`get_verification_token`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -158,6 +203,13 @@ pub enum UserCreateOAuth2ApplicationError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`user_create_runner_registration_token`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UserCreateRunnerRegistrationTokenError { + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`user_create_token`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -179,6 +231,7 @@ pub enum UserCurrentCheckFollowingError { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UserCurrentCheckStarringError { + Status403(), Status404(), UnknownValue(serde_json::Value), } @@ -213,6 +266,7 @@ pub enum UserCurrentDeleteKeyError { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UserCurrentDeleteStarError { + Status403(), Status404(), UnknownValue(serde_json::Value), } @@ -272,6 +326,7 @@ pub enum UserCurrentListReposError { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UserCurrentListStarredError { + Status403(), UnknownValue(serde_json::Value), } @@ -511,6 +566,7 @@ pub enum UserListReposError { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UserListStarredError { + Status403(), Status404(), UnknownValue(serde_json::Value), } @@ -572,5648 +628,6565 @@ pub enum UserVerifyGpgKeyError { pub async fn create_current_user_repo(configuration: &configuration::Configuration, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/repos", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/user/repos", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Repository`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Repository`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn create_user_variable(configuration: &configuration::Configuration, variablename: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_variablename = variablename; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/actions/variables/{variablename}", configuration.base_path, variablename=crate::apis::urlencode(p_path_variablename)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/user/actions/variables/{variablename}", local_var_configuration.base_path, variablename=crate::apis::urlencode(variablename)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn delete_user_runner(configuration: &configuration::Configuration, runner_id: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_runner_id = runner_id; + + let uri_str = format!("{}/user/actions/runners/{runner_id}", configuration.base_path, runner_id=crate::apis::urlencode(p_path_runner_id)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn delete_user_secret(configuration: &configuration::Configuration, secretname: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_secretname = secretname; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/actions/secrets/{secretname}", configuration.base_path, secretname=crate::apis::urlencode(p_path_secretname)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/user/actions/secrets/{secretname}", local_var_configuration.base_path, secretname=crate::apis::urlencode(secretname)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn delete_user_variable(configuration: &configuration::Configuration, variablename: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_variablename = variablename; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/actions/variables/{variablename}", configuration.base_path, variablename=crate::apis::urlencode(p_path_variablename)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/user/actions/variables/{variablename}", local_var_configuration.base_path, variablename=crate::apis::urlencode(variablename)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_user_runner(configuration: &configuration::Configuration, runner_id: &str) -> Result<(), Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_path_runner_id = runner_id; + + let uri_str = format!("{}/user/actions/runners/{runner_id}", configuration.base_path, runner_id=crate::apis::urlencode(p_path_runner_id)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_user_runners(configuration: &configuration::Configuration, ) -> Result<(), Error> { + + let uri_str = format!("{}/user/actions/runners", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_user_settings(configuration: &configuration::Configuration, ) -> Result, Error> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/settings", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/settings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UserSettings>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UserSettings>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_user_variable(configuration: &configuration::Configuration, variablename: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_variablename = variablename; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/actions/variables/{variablename}", configuration.base_path, variablename=crate::apis::urlencode(p_path_variablename)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/actions/variables/{variablename}", local_var_configuration.base_path, variablename=crate::apis::urlencode(variablename)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionVariable`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionVariable`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_user_variables_list(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/actions/variables", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/actions/variables", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ActionVariable>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ActionVariable>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_user_workflow_jobs(configuration: &configuration::Configuration, status: Option<&str>, page: Option, limit: Option) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_query_status = status; + let p_query_page = page; + let p_query_limit = limit; + + let uri_str = format!("{}/user/actions/jobs", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_status { + req_builder = req_builder.query(&[("status", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowJobsResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn get_user_workflow_runs(configuration: &configuration::Configuration, event: Option<&str>, branch: Option<&str>, status: Option<&str>, actor: Option<&str>, head_sha: Option<&str>, page: Option, limit: Option) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_query_event = event; + let p_query_branch = branch; + let p_query_status = status; + let p_query_actor = actor; + let p_query_head_sha = head_sha; + let p_query_page = page; + let p_query_limit = limit; + + let uri_str = format!("{}/user/actions/runs", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_query_event { + req_builder = req_builder.query(&[("event", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_branch { + req_builder = req_builder.query(&[("branch", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_status { + req_builder = req_builder.query(&[("status", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_actor { + req_builder = req_builder.query(&[("actor", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_head_sha { + req_builder = req_builder.query(&[("head_sha", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); + } + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActionWorkflowRunsResponse`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ActionWorkflowRunsResponse`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn get_verification_token(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/gpg_key_token", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/gpg_key_token", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Ok(content), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn update_user_secret(configuration: &configuration::Configuration, secretname: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_secretname = secretname; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/actions/secrets/{secretname}", configuration.base_path, secretname=crate::apis::urlencode(p_path_secretname)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/user/actions/secrets/{secretname}", local_var_configuration.base_path, secretname=crate::apis::urlencode(secretname)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn update_user_settings(configuration: &configuration::Configuration, body: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/settings", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/user/settings", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UserSettings>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UserSettings>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn update_user_variable(configuration: &configuration::Configuration, variablename: &str, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_variablename = variablename; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/actions/variables/{variablename}", configuration.base_path, variablename=crate::apis::urlencode(p_path_variablename)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/user/actions/variables/{variablename}", local_var_configuration.base_path, variablename=crate::apis::urlencode(variablename)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_add_email(configuration: &configuration::Configuration, body: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/emails", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/user/emails", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Email>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Email>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_block_user(configuration: &configuration::Configuration, username: &str, note: Option<&str>) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_query_note = note; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/blocks/{username}", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/user/blocks/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = note { - local_var_req_builder = local_var_req_builder.query(&[("note", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_note { + req_builder = req_builder.query(&[("note", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_check_following(configuration: &configuration::Configuration, username: &str, target: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_path_target = target; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/following/{target}", configuration.base_path, username=crate::apis::urlencode(p_path_username), target=crate::apis::urlencode(p_path_target)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/following/{target}", local_var_configuration.base_path, username=crate::apis::urlencode(username), target=crate::apis::urlencode(target)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_check_user_block(configuration: &configuration::Configuration, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/blocks/{username}", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/blocks/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_create_hook(configuration: &configuration::Configuration, body: models::CreateHookOption) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/hooks", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/user/hooks", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_create_o_auth2_application(configuration: &configuration::Configuration, body: models::CreateOAuth2ApplicationOptions) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/applications/oauth2", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/user/applications/oauth2", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2Application`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2Application`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn user_create_runner_registration_token(configuration: &configuration::Configuration, ) -> Result<(), Error> { + + let uri_str = format!("{}/user/actions/runners/registration-token", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("access_token", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("sudo", value)]); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.query(&[("token", value)]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("X-GITEA-OTP", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Authorization", value); + }; + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, + }; + req_builder = req_builder.header("Sudo", value); + }; + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); + }; + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + Ok(()) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_create_token(configuration: &configuration::Configuration, username: &str, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/tokens", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/tokens", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AccessToken`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AccessToken`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_check_following(configuration: &configuration::Configuration, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/following/{username}", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/following/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_check_starring(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/starred/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/starred/{owner}/{repo}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_delete_follow(configuration: &configuration::Configuration, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/following/{username}", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/user/following/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_delete_gpg_key(configuration: &configuration::Configuration, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/gpg_keys/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/user/gpg_keys/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_delete_key(configuration: &configuration::Configuration, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/keys/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/user/keys/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_delete_star(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/starred/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/user/starred/{owner}/{repo}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_get_gpg_key(configuration: &configuration::Configuration, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/gpg_keys/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/gpg_keys/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GpgKey`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GpgKey`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_get_key(configuration: &configuration::Configuration, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/keys/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/keys/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PublicKey`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PublicKey`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_list_followers(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/followers", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/followers", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_list_following(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/following", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/following", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_list_gpg_keys(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/gpg_keys", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/gpg_keys", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GpgKey>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GpgKey>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_list_keys(configuration: &configuration::Configuration, fingerprint: Option<&str>, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_fingerprint = fingerprint; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/keys", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/keys", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = fingerprint { - local_var_req_builder = local_var_req_builder.query(&[("fingerprint", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_fingerprint { + req_builder = req_builder.query(&[("fingerprint", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PublicKey>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PublicKey>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_list_repos(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/repos", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/repos", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Repository>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Repository>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_list_starred(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/starred", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/starred", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Repository>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Repository>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_list_subscriptions(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/subscriptions", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/subscriptions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Repository>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Repository>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_post_gpg_key(configuration: &configuration::Configuration, form: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_form = form; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/gpg_keys", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/user/gpg_keys", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&form); + req_builder = req_builder.json(&p_body_form); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GpgKey`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GpgKey`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_post_key(configuration: &configuration::Configuration, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/keys", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/user/keys", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PublicKey`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PublicKey`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_put_follow(configuration: &configuration::Configuration, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/following/{username}", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/user/following/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_put_star(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_owner = owner; + let p_path_repo = repo; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/starred/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo)); + let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str); - let local_var_uri_str = format!("{}/user/starred/{owner}/{repo}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_current_tracked_times(configuration: &configuration::Configuration, page: Option, limit: Option, since: Option, before: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; + let p_query_since = since; + let p_query_before = before; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/times", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/times", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = since { - local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_since { + req_builder = req_builder.query(&[("since", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = before { - local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_before { + req_builder = req_builder.query(&[("before", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TrackedTime>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::TrackedTime>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_delete_access_token(configuration: &configuration::Configuration, username: &str, token: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_path_token = token; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/tokens/{token}", configuration.base_path, username=crate::apis::urlencode(p_path_username), token=crate::apis::urlencode(p_path_token)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/tokens/{token}", local_var_configuration.base_path, username=crate::apis::urlencode(username), token=crate::apis::urlencode(token)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_delete_avatar(configuration: &configuration::Configuration, ) -> Result<(), Error> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/avatar", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/user/avatar", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_delete_email(configuration: &configuration::Configuration, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/emails", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/user/emails", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_delete_hook(configuration: &configuration::Configuration, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/hooks/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/user/hooks/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_delete_o_auth2_application(configuration: &configuration::Configuration, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/applications/oauth2/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/user/applications/oauth2/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_edit_hook(configuration: &configuration::Configuration, id: i64, body: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/hooks/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/user/hooks/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_get(configuration: &configuration::Configuration, username: &str) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::User`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::User`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_get_current(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::User`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::User`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_get_heatmap_data(configuration: &configuration::Configuration, username: &str) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/heatmap", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/heatmap", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UserHeatmapData>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UserHeatmapData>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_get_hook(configuration: &configuration::Configuration, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/hooks/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/hooks/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Hook`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Hook`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_get_o_auth2_application(configuration: &configuration::Configuration, id: i64) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/applications/oauth2/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/applications/oauth2/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2Application`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2Application`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_get_oauth2_application(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/applications/oauth2", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/applications/oauth2", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::OAuth2Application>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::OAuth2Application>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_get_runner_registration_token(configuration: &configuration::Configuration, ) -> Result<(), Error> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/actions/runners/registration-token", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/actions/runners/registration-token", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_get_stop_watches(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/stopwatches", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/stopwatches", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::StopWatch>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::StopWatch>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_get_tokens(configuration: &configuration::Configuration, username: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/tokens", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/tokens", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::AccessToken>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::AccessToken>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_list_activity_feeds(configuration: &configuration::Configuration, username: &str, only_performed_by: Option, date: Option, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_query_only_performed_by = only_performed_by; + let p_query_date = date; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/activities/feeds", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/activities/feeds", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = only_performed_by { - local_var_req_builder = local_var_req_builder.query(&[("only-performed-by", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_only_performed_by { + req_builder = req_builder.query(&[("only-performed-by", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = date { - local_var_req_builder = local_var_req_builder.query(&[("date", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_date { + req_builder = req_builder.query(&[("date", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Activity>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Activity>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_list_blocks(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/blocks", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/blocks", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_list_emails(configuration: &configuration::Configuration, ) -> Result, Error> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/emails", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/emails", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Email>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Email>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_list_followers(configuration: &configuration::Configuration, username: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/followers", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/followers", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_list_following(configuration: &configuration::Configuration, username: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/following", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/following", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_list_gpg_keys(configuration: &configuration::Configuration, username: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/gpg_keys", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/gpg_keys", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GpgKey>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GpgKey>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_list_hooks(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/hooks", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/hooks", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Hook>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Hook>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_list_keys(configuration: &configuration::Configuration, username: &str, fingerprint: Option<&str>, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_query_fingerprint = fingerprint; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/keys", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/keys", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = fingerprint { - local_var_req_builder = local_var_req_builder.query(&[("fingerprint", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_fingerprint { + req_builder = req_builder.query(&[("fingerprint", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PublicKey>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PublicKey>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_list_repos(configuration: &configuration::Configuration, username: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/repos", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/repos", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Repository>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Repository>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_list_starred(configuration: &configuration::Configuration, username: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/starred", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/starred", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Repository>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Repository>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_list_subscriptions(configuration: &configuration::Configuration, username: &str, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/{username}/subscriptions", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/{username}/subscriptions", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Repository>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Repository>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_list_teams(configuration: &configuration::Configuration, page: Option, limit: Option) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/teams", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/user/teams", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Team>`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Team>`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_search(configuration: &configuration::Configuration, q: Option<&str>, uid: Option, page: Option, limit: Option) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_query_q = q; + let p_query_uid = uid; + let p_query_page = page; + let p_query_limit = limit; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/users/search", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/users/search", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = q { - local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_q { + req_builder = req_builder.query(&[("q", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = uid { - local_var_req_builder = local_var_req_builder.query(&[("uid", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_uid { + req_builder = req_builder.query(&[("uid", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = page { - local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_page { + req_builder = req_builder.query(&[("page", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = limit { - local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + if let Some(ref param_value) = p_query_limit { + req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UserSearch200Response`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UserSearch200Response`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_unblock_user(configuration: &configuration::Configuration, username: &str) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_username = username; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/blocks/{username}", configuration.base_path, username=crate::apis::urlencode(p_path_username)); + let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str); - let local_var_uri_str = format!("{}/user/blocks/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_update_avatar(configuration: &configuration::Configuration, body: Option) -> Result<(), Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/avatar", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/user/avatar", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + if !status.is_client_error() && !status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_update_o_auth2_application(configuration: &configuration::Configuration, id: i64, body: models::CreateOAuth2ApplicationOptions) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_path_id = id; + let p_body_body = body; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/applications/oauth2/{id}", configuration.base_path, id=p_path_id); + let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str); - let local_var_uri_str = format!("{}/user/applications/oauth2/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - local_var_req_builder = local_var_req_builder.json(&body); + req_builder = req_builder.json(&p_body_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2Application`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2Application`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } pub async fn user_verify_gpg_key(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/user/gpg_key_verify", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); - let local_var_uri_str = format!("{}/user/gpg_key_verify", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]); + req_builder = req_builder.query(&[("access_token", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]); + req_builder = req_builder.query(&[("sudo", value)]); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]); + req_builder = req_builder.query(&[("token", value)]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value); + req_builder = req_builder.header("X-GITEA-OTP", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + req_builder = req_builder.header("Authorization", value); }; - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, + if let Some(ref apikey) = configuration.api_key { + let key = apikey.key.clone(); + let value = match apikey.prefix { + Some(ref prefix) => format!("{} {}", prefix, key), + None => key, }; - local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value); + req_builder = req_builder.header("Sudo", value); }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + if let Some(ref auth_conf) = configuration.basic_auth { + req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned()); }; - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + match content_type { + ContentType::Json => serde_json::from_str(&content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GpgKey`"))), + ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GpgKey`")))), + } } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) } } diff --git a/crates/gitea-client/src/models/access_token.rs b/crates/gitea-client/src/models/access_token.rs index 9474975..89cd8f7 100644 --- a/crates/gitea-client/src/models/access_token.rs +++ b/crates/gitea-client/src/models/access_token.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -13,14 +13,25 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AccessToken { + /// The timestamp when the token was created + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// The unique identifier of the access token #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// The timestamp when the token was last used + #[serde(rename = "last_used_at", skip_serializing_if = "Option::is_none")] + pub last_used_at: Option, + /// The name of the access token #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// The scopes granted to this access token #[serde(rename = "scopes", skip_serializing_if = "Option::is_none")] pub scopes: Option>, + /// The SHA1 hash of the access token #[serde(rename = "sha1", skip_serializing_if = "Option::is_none")] pub sha1: Option, + /// The last eight characters of the token #[serde(rename = "token_last_eight", skip_serializing_if = "Option::is_none")] pub token_last_eight: Option, } @@ -28,7 +39,9 @@ pub struct AccessToken { impl AccessToken { pub fn new() -> AccessToken { AccessToken { + created_at: None, id: None, + last_used_at: None, name: None, scopes: None, sha1: None, diff --git a/crates/gitea-client/src/models/action_artifact.rs b/crates/gitea-client/src/models/action_artifact.rs new file mode 100644 index 0000000..10be456 --- /dev/null +++ b/crates/gitea-client/src/models/action_artifact.rs @@ -0,0 +1,56 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionArtifact : ActionArtifact represents a ActionArtifact +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionArtifact { + #[serde(rename = "archive_download_url", skip_serializing_if = "Option::is_none")] + pub archive_download_url: Option, + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "expired", skip_serializing_if = "Option::is_none")] + pub expired: Option, + #[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")] + pub expires_at: Option, + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "size_in_bytes", skip_serializing_if = "Option::is_none")] + pub size_in_bytes: Option, + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + #[serde(rename = "url", skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(rename = "workflow_run", skip_serializing_if = "Option::is_none")] + pub workflow_run: Option>, +} + +impl ActionArtifact { + /// ActionArtifact represents a ActionArtifact + pub fn new() -> ActionArtifact { + ActionArtifact { + archive_download_url: None, + created_at: None, + expired: None, + expires_at: None, + id: None, + name: None, + size_in_bytes: None, + updated_at: None, + url: None, + workflow_run: None, + } + } +} + diff --git a/crates/gitea-client/src/models/action_artifacts_response.rs b/crates/gitea-client/src/models/action_artifacts_response.rs new file mode 100644 index 0000000..3fb2ae2 --- /dev/null +++ b/crates/gitea-client/src/models/action_artifacts_response.rs @@ -0,0 +1,32 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionArtifactsResponse : ActionArtifactsResponse returns ActionArtifacts +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionArtifactsResponse { + #[serde(rename = "artifacts", skip_serializing_if = "Option::is_none")] + pub artifacts: Option>, + #[serde(rename = "total_count", skip_serializing_if = "Option::is_none")] + pub total_count: Option, +} + +impl ActionArtifactsResponse { + /// ActionArtifactsResponse returns ActionArtifacts + pub fn new() -> ActionArtifactsResponse { + ActionArtifactsResponse { + artifacts: None, + total_count: None, + } + } +} + diff --git a/crates/gitea-client/src/models/action_runner.rs b/crates/gitea-client/src/models/action_runner.rs new file mode 100644 index 0000000..8270de5 --- /dev/null +++ b/crates/gitea-client/src/models/action_runner.rs @@ -0,0 +1,44 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionRunner : ActionRunner represents a Runner +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionRunner { + #[serde(rename = "busy", skip_serializing_if = "Option::is_none")] + pub busy: Option, + #[serde(rename = "ephemeral", skip_serializing_if = "Option::is_none")] + pub ephemeral: Option, + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "labels", skip_serializing_if = "Option::is_none")] + pub labels: Option>, + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "status", skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +impl ActionRunner { + /// ActionRunner represents a Runner + pub fn new() -> ActionRunner { + ActionRunner { + busy: None, + ephemeral: None, + id: None, + labels: None, + name: None, + status: None, + } + } +} + diff --git a/crates/gitea-client/src/models/action_runner_label.rs b/crates/gitea-client/src/models/action_runner_label.rs new file mode 100644 index 0000000..2c0e62c --- /dev/null +++ b/crates/gitea-client/src/models/action_runner_label.rs @@ -0,0 +1,35 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionRunnerLabel : ActionRunnerLabel represents a Runner Label +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionRunnerLabel { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub r#type: Option, +} + +impl ActionRunnerLabel { + /// ActionRunnerLabel represents a Runner Label + pub fn new() -> ActionRunnerLabel { + ActionRunnerLabel { + id: None, + name: None, + r#type: None, + } + } +} + diff --git a/crates/gitea-client/src/models/action_runners_response.rs b/crates/gitea-client/src/models/action_runners_response.rs new file mode 100644 index 0000000..349c424 --- /dev/null +++ b/crates/gitea-client/src/models/action_runners_response.rs @@ -0,0 +1,32 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionRunnersResponse : ActionRunnersResponse returns Runners +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionRunnersResponse { + #[serde(rename = "runners", skip_serializing_if = "Option::is_none")] + pub runners: Option>, + #[serde(rename = "total_count", skip_serializing_if = "Option::is_none")] + pub total_count: Option, +} + +impl ActionRunnersResponse { + /// ActionRunnersResponse returns Runners + pub fn new() -> ActionRunnersResponse { + ActionRunnersResponse { + runners: None, + total_count: None, + } + } +} + diff --git a/crates/gitea-client/src/models/action_task.rs b/crates/gitea-client/src/models/action_task.rs new file mode 100644 index 0000000..7854379 --- /dev/null +++ b/crates/gitea-client/src/models/action_task.rs @@ -0,0 +1,75 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionTask : ActionTask represents a ActionTask +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionTask { + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// DisplayTitle is the display title for the workflow run + #[serde(rename = "display_title", skip_serializing_if = "Option::is_none")] + pub display_title: Option, + /// Event is the type of event that triggered the workflow + #[serde(rename = "event", skip_serializing_if = "Option::is_none")] + pub event: Option, + /// HeadBranch is the branch that triggered the workflow + #[serde(rename = "head_branch", skip_serializing_if = "Option::is_none")] + pub head_branch: Option, + /// HeadSHA is the commit SHA that triggered the workflow + #[serde(rename = "head_sha", skip_serializing_if = "Option::is_none")] + pub head_sha: Option, + /// ID is the unique identifier for the action task + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// Name is the name of the workflow + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// RunNumber is the sequential number of the workflow run + #[serde(rename = "run_number", skip_serializing_if = "Option::is_none")] + pub run_number: Option, + #[serde(rename = "run_started_at", skip_serializing_if = "Option::is_none")] + pub run_started_at: Option, + /// Status indicates the current status of the workflow run + #[serde(rename = "status", skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + /// URL is the API URL for this workflow run + #[serde(rename = "url", skip_serializing_if = "Option::is_none")] + pub url: Option, + /// WorkflowID is the identifier of the workflow + #[serde(rename = "workflow_id", skip_serializing_if = "Option::is_none")] + pub workflow_id: Option, +} + +impl ActionTask { + /// ActionTask represents a ActionTask + pub fn new() -> ActionTask { + ActionTask { + created_at: None, + display_title: None, + event: None, + head_branch: None, + head_sha: None, + id: None, + name: None, + run_number: None, + run_started_at: None, + status: None, + updated_at: None, + url: None, + workflow_id: None, + } + } +} + diff --git a/crates/gitea-client/src/models/action_task_response.rs b/crates/gitea-client/src/models/action_task_response.rs new file mode 100644 index 0000000..8aba9be --- /dev/null +++ b/crates/gitea-client/src/models/action_task_response.rs @@ -0,0 +1,34 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionTaskResponse : ActionTaskResponse returns a ActionTask +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionTaskResponse { + /// TotalCount is the total number of workflow runs + #[serde(rename = "total_count", skip_serializing_if = "Option::is_none")] + pub total_count: Option, + /// Entries contains the list of workflow runs + #[serde(rename = "workflow_runs", skip_serializing_if = "Option::is_none")] + pub workflow_runs: Option>, +} + +impl ActionTaskResponse { + /// ActionTaskResponse returns a ActionTask + pub fn new() -> ActionTaskResponse { + ActionTaskResponse { + total_count: None, + workflow_runs: None, + } + } +} + diff --git a/crates/gitea-client/src/models/action_variable.rs b/crates/gitea-client/src/models/action_variable.rs index 7021e64..90714ad 100644 --- a/crates/gitea-client/src/models/action_variable.rs +++ b/crates/gitea-client/src/models/action_variable.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -17,6 +17,9 @@ pub struct ActionVariable { /// the value of the variable #[serde(rename = "data", skip_serializing_if = "Option::is_none")] pub data: Option, + /// the description of the variable + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, /// the name of the variable #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, @@ -33,6 +36,7 @@ impl ActionVariable { pub fn new() -> ActionVariable { ActionVariable { data: None, + description: None, name: None, owner_id: None, repo_id: None, diff --git a/crates/gitea-client/src/models/action_workflow.rs b/crates/gitea-client/src/models/action_workflow.rs new file mode 100644 index 0000000..fb848fd --- /dev/null +++ b/crates/gitea-client/src/models/action_workflow.rs @@ -0,0 +1,63 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionWorkflow : ActionWorkflow represents a ActionWorkflow +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionWorkflow { + /// BadgeURL is the URL for the workflow badge + #[serde(rename = "badge_url", skip_serializing_if = "Option::is_none")] + pub badge_url: Option, + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "deleted_at", skip_serializing_if = "Option::is_none")] + pub deleted_at: Option, + /// HTMLURL is the web URL for viewing the workflow + #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] + pub html_url: Option, + /// ID is the unique identifier for the workflow + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// Name is the name of the workflow + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Path is the file path of the workflow + #[serde(rename = "path", skip_serializing_if = "Option::is_none")] + pub path: Option, + /// State indicates if the workflow is active or disabled + #[serde(rename = "state", skip_serializing_if = "Option::is_none")] + pub state: Option, + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + /// URL is the API URL for this workflow + #[serde(rename = "url", skip_serializing_if = "Option::is_none")] + pub url: Option, +} + +impl ActionWorkflow { + /// ActionWorkflow represents a ActionWorkflow + pub fn new() -> ActionWorkflow { + ActionWorkflow { + badge_url: None, + created_at: None, + deleted_at: None, + html_url: None, + id: None, + name: None, + path: None, + state: None, + updated_at: None, + url: None, + } + } +} + diff --git a/crates/gitea-client/src/models/action_workflow_job.rs b/crates/gitea-client/src/models/action_workflow_job.rs new file mode 100644 index 0000000..e0e08a8 --- /dev/null +++ b/crates/gitea-client/src/models/action_workflow_job.rs @@ -0,0 +1,80 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionWorkflowJob : ActionWorkflowJob represents a WorkflowJob +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionWorkflowJob { + #[serde(rename = "completed_at", skip_serializing_if = "Option::is_none")] + pub completed_at: Option, + #[serde(rename = "conclusion", skip_serializing_if = "Option::is_none")] + pub conclusion: Option, + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "head_branch", skip_serializing_if = "Option::is_none")] + pub head_branch: Option, + #[serde(rename = "head_sha", skip_serializing_if = "Option::is_none")] + pub head_sha: Option, + #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] + pub html_url: Option, + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "labels", skip_serializing_if = "Option::is_none")] + pub labels: Option>, + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "run_attempt", skip_serializing_if = "Option::is_none")] + pub run_attempt: Option, + #[serde(rename = "run_id", skip_serializing_if = "Option::is_none")] + pub run_id: Option, + #[serde(rename = "run_url", skip_serializing_if = "Option::is_none")] + pub run_url: Option, + #[serde(rename = "runner_id", skip_serializing_if = "Option::is_none")] + pub runner_id: Option, + #[serde(rename = "runner_name", skip_serializing_if = "Option::is_none")] + pub runner_name: Option, + #[serde(rename = "started_at", skip_serializing_if = "Option::is_none")] + pub started_at: Option, + #[serde(rename = "status", skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "steps", skip_serializing_if = "Option::is_none")] + pub steps: Option>, + #[serde(rename = "url", skip_serializing_if = "Option::is_none")] + pub url: Option, +} + +impl ActionWorkflowJob { + /// ActionWorkflowJob represents a WorkflowJob + pub fn new() -> ActionWorkflowJob { + ActionWorkflowJob { + completed_at: None, + conclusion: None, + created_at: None, + head_branch: None, + head_sha: None, + html_url: None, + id: None, + labels: None, + name: None, + run_attempt: None, + run_id: None, + run_url: None, + runner_id: None, + runner_name: None, + started_at: None, + status: None, + steps: None, + url: None, + } + } +} + diff --git a/crates/gitea-client/src/models/action_workflow_jobs_response.rs b/crates/gitea-client/src/models/action_workflow_jobs_response.rs new file mode 100644 index 0000000..2c0a0dc --- /dev/null +++ b/crates/gitea-client/src/models/action_workflow_jobs_response.rs @@ -0,0 +1,32 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionWorkflowJobsResponse : ActionWorkflowJobsResponse returns ActionWorkflowJobs +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionWorkflowJobsResponse { + #[serde(rename = "jobs", skip_serializing_if = "Option::is_none")] + pub jobs: Option>, + #[serde(rename = "total_count", skip_serializing_if = "Option::is_none")] + pub total_count: Option, +} + +impl ActionWorkflowJobsResponse { + /// ActionWorkflowJobsResponse returns ActionWorkflowJobs + pub fn new() -> ActionWorkflowJobsResponse { + ActionWorkflowJobsResponse { + jobs: None, + total_count: None, + } + } +} + diff --git a/crates/gitea-client/src/models/action_workflow_response.rs b/crates/gitea-client/src/models/action_workflow_response.rs new file mode 100644 index 0000000..c191c02 --- /dev/null +++ b/crates/gitea-client/src/models/action_workflow_response.rs @@ -0,0 +1,32 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionWorkflowResponse : ActionWorkflowResponse returns a ActionWorkflow +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionWorkflowResponse { + #[serde(rename = "total_count", skip_serializing_if = "Option::is_none")] + pub total_count: Option, + #[serde(rename = "workflows", skip_serializing_if = "Option::is_none")] + pub workflows: Option>, +} + +impl ActionWorkflowResponse { + /// ActionWorkflowResponse returns a ActionWorkflow + pub fn new() -> ActionWorkflowResponse { + ActionWorkflowResponse { + total_count: None, + workflows: None, + } + } +} + diff --git a/crates/gitea-client/src/models/action_workflow_run.rs b/crates/gitea-client/src/models/action_workflow_run.rs new file mode 100644 index 0000000..7ac0fac --- /dev/null +++ b/crates/gitea-client/src/models/action_workflow_run.rs @@ -0,0 +1,83 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionWorkflowRun : ActionWorkflowRun represents a WorkflowRun +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionWorkflowRun { + #[serde(rename = "actor", skip_serializing_if = "Option::is_none")] + pub actor: Option>, + #[serde(rename = "completed_at", skip_serializing_if = "Option::is_none")] + pub completed_at: Option, + #[serde(rename = "conclusion", skip_serializing_if = "Option::is_none")] + pub conclusion: Option, + #[serde(rename = "display_title", skip_serializing_if = "Option::is_none")] + pub display_title: Option, + #[serde(rename = "event", skip_serializing_if = "Option::is_none")] + pub event: Option, + #[serde(rename = "head_branch", skip_serializing_if = "Option::is_none")] + pub head_branch: Option, + #[serde(rename = "head_repository", skip_serializing_if = "Option::is_none")] + pub head_repository: Option>, + #[serde(rename = "head_sha", skip_serializing_if = "Option::is_none")] + pub head_sha: Option, + #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] + pub html_url: Option, + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "path", skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(rename = "repository", skip_serializing_if = "Option::is_none")] + pub repository: Option>, + #[serde(rename = "repository_id", skip_serializing_if = "Option::is_none")] + pub repository_id: Option, + #[serde(rename = "run_attempt", skip_serializing_if = "Option::is_none")] + pub run_attempt: Option, + #[serde(rename = "run_number", skip_serializing_if = "Option::is_none")] + pub run_number: Option, + #[serde(rename = "started_at", skip_serializing_if = "Option::is_none")] + pub started_at: Option, + #[serde(rename = "status", skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "trigger_actor", skip_serializing_if = "Option::is_none")] + pub trigger_actor: Option>, + #[serde(rename = "url", skip_serializing_if = "Option::is_none")] + pub url: Option, +} + +impl ActionWorkflowRun { + /// ActionWorkflowRun represents a WorkflowRun + pub fn new() -> ActionWorkflowRun { + ActionWorkflowRun { + actor: None, + completed_at: None, + conclusion: None, + display_title: None, + event: None, + head_branch: None, + head_repository: None, + head_sha: None, + html_url: None, + id: None, + path: None, + repository: None, + repository_id: None, + run_attempt: None, + run_number: None, + started_at: None, + status: None, + trigger_actor: None, + url: None, + } + } +} + diff --git a/crates/gitea-client/src/models/action_workflow_runs_response.rs b/crates/gitea-client/src/models/action_workflow_runs_response.rs new file mode 100644 index 0000000..7cbeaed --- /dev/null +++ b/crates/gitea-client/src/models/action_workflow_runs_response.rs @@ -0,0 +1,32 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionWorkflowRunsResponse : ActionWorkflowRunsResponse returns ActionWorkflowRuns +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionWorkflowRunsResponse { + #[serde(rename = "total_count", skip_serializing_if = "Option::is_none")] + pub total_count: Option, + #[serde(rename = "workflow_runs", skip_serializing_if = "Option::is_none")] + pub workflow_runs: Option>, +} + +impl ActionWorkflowRunsResponse { + /// ActionWorkflowRunsResponse returns ActionWorkflowRuns + pub fn new() -> ActionWorkflowRunsResponse { + ActionWorkflowRunsResponse { + total_count: None, + workflow_runs: None, + } + } +} + diff --git a/crates/gitea-client/src/models/action_workflow_step.rs b/crates/gitea-client/src/models/action_workflow_step.rs new file mode 100644 index 0000000..f6d6769 --- /dev/null +++ b/crates/gitea-client/src/models/action_workflow_step.rs @@ -0,0 +1,44 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ActionWorkflowStep : ActionWorkflowStep represents a step of a WorkflowJob +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActionWorkflowStep { + #[serde(rename = "completed_at", skip_serializing_if = "Option::is_none")] + pub completed_at: Option, + #[serde(rename = "conclusion", skip_serializing_if = "Option::is_none")] + pub conclusion: Option, + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "number", skip_serializing_if = "Option::is_none")] + pub number: Option, + #[serde(rename = "started_at", skip_serializing_if = "Option::is_none")] + pub started_at: Option, + #[serde(rename = "status", skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +impl ActionWorkflowStep { + /// ActionWorkflowStep represents a step of a WorkflowJob + pub fn new() -> ActionWorkflowStep { + ActionWorkflowStep { + completed_at: None, + conclusion: None, + name: None, + number: None, + started_at: None, + status: None, + } + } +} + diff --git a/crates/gitea-client/src/models/activity.rs b/crates/gitea-client/src/models/activity.rs index 3c44fe1..db577a1 100644 --- a/crates/gitea-client/src/models/activity.rs +++ b/crates/gitea-client/src/models/activity.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -15,28 +15,38 @@ use serde::{Deserialize, Serialize}; pub struct Activity { #[serde(rename = "act_user", skip_serializing_if = "Option::is_none")] pub act_user: Option>, + /// The ID of the user who performed the action #[serde(rename = "act_user_id", skip_serializing_if = "Option::is_none")] pub act_user_id: Option, #[serde(rename = "comment", skip_serializing_if = "Option::is_none")] pub comment: Option>, + /// The ID of the comment associated with the activity (if applicable) #[serde(rename = "comment_id", skip_serializing_if = "Option::is_none")] pub comment_id: Option, + /// Additional content or details about the activity #[serde(rename = "content", skip_serializing_if = "Option::is_none")] pub content: Option, + /// The date and time when the activity occurred #[serde(rename = "created", skip_serializing_if = "Option::is_none")] pub created: Option, + /// The unique identifier of the activity #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// Whether this activity is from a private repository #[serde(rename = "is_private", skip_serializing_if = "Option::is_none")] pub is_private: Option, + /// the type of action #[serde(rename = "op_type", skip_serializing_if = "Option::is_none")] - pub op_type: Option, + pub op_type: Option, + /// The name of the git reference (branch/tag) associated with the activity #[serde(rename = "ref_name", skip_serializing_if = "Option::is_none")] pub ref_name: Option, #[serde(rename = "repo", skip_serializing_if = "Option::is_none")] pub repo: Option>, + /// The ID of the repository associated with the activity #[serde(rename = "repo_id", skip_serializing_if = "Option::is_none")] pub repo_id: Option, + /// The ID of the user who receives/sees this activity #[serde(rename = "user_id", skip_serializing_if = "Option::is_none")] pub user_id: Option, } @@ -60,4 +70,68 @@ impl Activity { } } } +/// the type of action +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum OpType { + #[serde(rename = "create_repo")] + CreateRepo, + #[serde(rename = "rename_repo")] + RenameRepo, + #[serde(rename = "star_repo")] + StarRepo, + #[serde(rename = "watch_repo")] + WatchRepo, + #[serde(rename = "commit_repo")] + CommitRepo, + #[serde(rename = "create_issue")] + CreateIssue, + #[serde(rename = "create_pull_request")] + CreatePullRequest, + #[serde(rename = "transfer_repo")] + TransferRepo, + #[serde(rename = "push_tag")] + PushTag, + #[serde(rename = "comment_issue")] + CommentIssue, + #[serde(rename = "merge_pull_request")] + MergePullRequest, + #[serde(rename = "close_issue")] + CloseIssue, + #[serde(rename = "reopen_issue")] + ReopenIssue, + #[serde(rename = "close_pull_request")] + ClosePullRequest, + #[serde(rename = "reopen_pull_request")] + ReopenPullRequest, + #[serde(rename = "delete_tag")] + DeleteTag, + #[serde(rename = "delete_branch")] + DeleteBranch, + #[serde(rename = "mirror_sync_push")] + MirrorSyncPush, + #[serde(rename = "mirror_sync_create")] + MirrorSyncCreate, + #[serde(rename = "mirror_sync_delete")] + MirrorSyncDelete, + #[serde(rename = "approve_pull_request")] + ApprovePullRequest, + #[serde(rename = "reject_pull_request")] + RejectPullRequest, + #[serde(rename = "comment_pull")] + CommentPull, + #[serde(rename = "publish_release")] + PublishRelease, + #[serde(rename = "pull_review_dismissed")] + PullReviewDismissed, + #[serde(rename = "pull_request_ready_for_review")] + PullRequestReadyForReview, + #[serde(rename = "auto_merge_pull_request")] + AutoMergePullRequest, +} + +impl Default for OpType { + fn default() -> OpType { + Self::CreateRepo + } +} diff --git a/crates/gitea-client/src/models/activity_pub.rs b/crates/gitea-client/src/models/activity_pub.rs index 73c5620..f2d4d13 100644 --- a/crates/gitea-client/src/models/activity_pub.rs +++ b/crates/gitea-client/src/models/activity_pub.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize}; /// ActivityPub : ActivityPub type #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ActivityPub { + /// Context defines the JSON-LD context for ActivityPub #[serde(rename = "@context", skip_serializing_if = "Option::is_none")] pub at_context: Option, } diff --git a/crates/gitea-client/src/models/add_collaborator_option.rs b/crates/gitea-client/src/models/add_collaborator_option.rs index eb2e2e2..4e0ead2 100644 --- a/crates/gitea-client/src/models/add_collaborator_option.rs +++ b/crates/gitea-client/src/models/add_collaborator_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AddCollaboratorOption { #[serde(rename = "permission", skip_serializing_if = "Option::is_none")] - pub permission: Option, + pub permission: Option, } impl AddCollaboratorOption { @@ -26,4 +26,20 @@ impl AddCollaboratorOption { } } } +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Permission { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, + #[serde(rename = "admin")] + Admin, +} + +impl Default for Permission { + fn default() -> Permission { + Self::Read + } +} diff --git a/crates/gitea-client/src/models/add_time_option.rs b/crates/gitea-client/src/models/add_time_option.rs index 6bcd4b0..ba1b31d 100644 --- a/crates/gitea-client/src/models/add_time_option.rs +++ b/crates/gitea-client/src/models/add_time_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -19,7 +19,7 @@ pub struct AddTimeOption { /// time in seconds #[serde(rename = "time")] pub time: i64, - /// User who spent the time (optional) + /// username of the user who spent the time working on the issue (optional) #[serde(rename = "user_name", skip_serializing_if = "Option::is_none")] pub user_name: Option, } diff --git a/crates/gitea-client/src/models/annotated_tag.rs b/crates/gitea-client/src/models/annotated_tag.rs index 08fe6b3..3264615 100644 --- a/crates/gitea-client/src/models/annotated_tag.rs +++ b/crates/gitea-client/src/models/annotated_tag.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,16 +14,20 @@ use serde::{Deserialize, Serialize}; /// AnnotatedTag : AnnotatedTag represents an annotated tag #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AnnotatedTag { + /// The message associated with the annotated tag #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, #[serde(rename = "object", skip_serializing_if = "Option::is_none")] pub object: Option>, + /// The SHA hash of the annotated tag #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, + /// The name of the annotated tag #[serde(rename = "tag", skip_serializing_if = "Option::is_none")] pub tag: Option, #[serde(rename = "tagger", skip_serializing_if = "Option::is_none")] pub tagger: Option>, + /// The URL to access the annotated tag #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, #[serde(rename = "verification", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/annotated_tag_object.rs b/crates/gitea-client/src/models/annotated_tag_object.rs index cb303ca..5d32ae9 100644 --- a/crates/gitea-client/src/models/annotated_tag_object.rs +++ b/crates/gitea-client/src/models/annotated_tag_object.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,10 +14,13 @@ use serde::{Deserialize, Serialize}; /// AnnotatedTagObject : AnnotatedTagObject contains meta information of the tag object #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AnnotatedTagObject { + /// The SHA hash of the tagged object #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, + /// The type of the tagged object (e.g., commit, tree) #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub r#type: Option, + /// The URL to access the tagged object #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/api_error.rs b/crates/gitea-client/src/models/api_error.rs index 03dd52a..d5b34d9 100644 --- a/crates/gitea-client/src/models/api_error.rs +++ b/crates/gitea-client/src/models/api_error.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,8 +14,10 @@ use serde::{Deserialize, Serialize}; /// ApiError : APIError is an api error with a message #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ApiError { + /// Message contains the error description #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, + /// URL contains the documentation URL for this error #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/apply_diff_patch_file_options.rs b/crates/gitea-client/src/models/apply_diff_patch_file_options.rs new file mode 100644 index 0000000..d3c07e4 --- /dev/null +++ b/crates/gitea-client/src/models/apply_diff_patch_file_options.rs @@ -0,0 +1,54 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// ApplyDiffPatchFileOptions : ApplyDiffPatchFileOptions options for applying a diff patch Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used) +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApplyDiffPatchFileOptions { + #[serde(rename = "author", skip_serializing_if = "Option::is_none")] + pub author: Option>, + /// branch (optional) to base this file from. if not given, the default branch is used + #[serde(rename = "branch", skip_serializing_if = "Option::is_none")] + pub branch: Option, + #[serde(rename = "committer", skip_serializing_if = "Option::is_none")] + pub committer: Option>, + #[serde(rename = "content")] + pub content: String, + #[serde(rename = "dates", skip_serializing_if = "Option::is_none")] + pub dates: Option>, + /// message (optional) for the commit of this file. if not supplied, a default message will be used + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, + /// new_branch (optional) will make a new branch from `branch` before creating the file + #[serde(rename = "new_branch", skip_serializing_if = "Option::is_none")] + pub new_branch: Option, + /// Add a Signed-off-by trailer by the committer at the end of the commit log message. + #[serde(rename = "signoff", skip_serializing_if = "Option::is_none")] + pub signoff: Option, +} + +impl ApplyDiffPatchFileOptions { + /// ApplyDiffPatchFileOptions options for applying a diff patch Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used) + pub fn new(content: String) -> ApplyDiffPatchFileOptions { + ApplyDiffPatchFileOptions { + author: None, + branch: None, + committer: None, + content, + dates: None, + message: None, + new_branch: None, + signoff: None, + } + } +} + diff --git a/crates/gitea-client/src/models/attachment.rs b/crates/gitea-client/src/models/attachment.rs index 7f0c5f2..8980756 100644 --- a/crates/gitea-client/src/models/attachment.rs +++ b/crates/gitea-client/src/models/attachment.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,18 +14,24 @@ use serde::{Deserialize, Serialize}; /// Attachment : Attachment a generic attachment #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Attachment { + /// DownloadURL is the URL to download the attachment #[serde(rename = "browser_download_url", skip_serializing_if = "Option::is_none")] pub browser_download_url: Option, #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, + /// DownloadCount is the number of times the attachment has been downloaded #[serde(rename = "download_count", skip_serializing_if = "Option::is_none")] pub download_count: Option, + /// ID is the unique identifier for the attachment #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// Name is the filename of the attachment #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// Size is the file size in bytes #[serde(rename = "size", skip_serializing_if = "Option::is_none")] pub size: Option, + /// UUID is the unique identifier for the attachment file #[serde(rename = "uuid", skip_serializing_if = "Option::is_none")] pub uuid: Option, } diff --git a/crates/gitea-client/src/models/badge.rs b/crates/gitea-client/src/models/badge.rs index df6849b..fb723ef 100644 --- a/crates/gitea-client/src/models/badge.rs +++ b/crates/gitea-client/src/models/badge.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/branch.rs b/crates/gitea-client/src/models/branch.rs index 9bff7b0..dcde1f7 100644 --- a/crates/gitea-client/src/models/branch.rs +++ b/crates/gitea-client/src/models/branch.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,20 +16,28 @@ use serde::{Deserialize, Serialize}; pub struct Branch { #[serde(rename = "commit", skip_serializing_if = "Option::is_none")] pub commit: Option>, + /// EffectiveBranchProtectionName is the name of the effective branch protection rule #[serde(rename = "effective_branch_protection_name", skip_serializing_if = "Option::is_none")] pub effective_branch_protection_name: Option, + /// EnableStatusCheck indicates if status checks are enabled #[serde(rename = "enable_status_check", skip_serializing_if = "Option::is_none")] pub enable_status_check: Option, + /// Name is the branch name #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// Protected indicates if the branch is protected #[serde(rename = "protected", skip_serializing_if = "Option::is_none")] pub protected: Option, + /// RequiredApprovals is the number of required approvals for pull requests #[serde(rename = "required_approvals", skip_serializing_if = "Option::is_none")] pub required_approvals: Option, + /// StatusCheckContexts contains the list of required status check contexts #[serde(rename = "status_check_contexts", skip_serializing_if = "Option::is_none")] pub status_check_contexts: Option>, + /// UserCanMerge indicates if the current user can merge to this branch #[serde(rename = "user_can_merge", skip_serializing_if = "Option::is_none")] pub user_can_merge: Option, + /// UserCanPush indicates if the current user can push to this branch #[serde(rename = "user_can_push", skip_serializing_if = "Option::is_none")] pub user_can_push: Option, } diff --git a/crates/gitea-client/src/models/branch_protection.rs b/crates/gitea-client/src/models/branch_protection.rs index 96c8199..f99865d 100644 --- a/crates/gitea-client/src/models/branch_protection.rs +++ b/crates/gitea-client/src/models/branch_protection.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -18,6 +18,8 @@ pub struct BranchProtection { pub approvals_whitelist_teams: Option>, #[serde(rename = "approvals_whitelist_username", skip_serializing_if = "Option::is_none")] pub approvals_whitelist_username: Option>, + #[serde(rename = "block_admin_merge_override", skip_serializing_if = "Option::is_none")] + pub block_admin_merge_override: Option, #[serde(rename = "block_on_official_review_requests", skip_serializing_if = "Option::is_none")] pub block_on_official_review_requests: Option, #[serde(rename = "block_on_outdated_branch", skip_serializing_if = "Option::is_none")] @@ -33,6 +35,10 @@ pub struct BranchProtection { pub dismiss_stale_approvals: Option, #[serde(rename = "enable_approvals_whitelist", skip_serializing_if = "Option::is_none")] pub enable_approvals_whitelist: Option, + #[serde(rename = "enable_force_push", skip_serializing_if = "Option::is_none")] + pub enable_force_push: Option, + #[serde(rename = "enable_force_push_allowlist", skip_serializing_if = "Option::is_none")] + pub enable_force_push_allowlist: Option, #[serde(rename = "enable_merge_whitelist", skip_serializing_if = "Option::is_none")] pub enable_merge_whitelist: Option, #[serde(rename = "enable_push", skip_serializing_if = "Option::is_none")] @@ -41,12 +47,21 @@ pub struct BranchProtection { pub enable_push_whitelist: Option, #[serde(rename = "enable_status_check", skip_serializing_if = "Option::is_none")] pub enable_status_check: Option, + #[serde(rename = "force_push_allowlist_deploy_keys", skip_serializing_if = "Option::is_none")] + pub force_push_allowlist_deploy_keys: Option, + #[serde(rename = "force_push_allowlist_teams", skip_serializing_if = "Option::is_none")] + pub force_push_allowlist_teams: Option>, + #[serde(rename = "force_push_allowlist_usernames", skip_serializing_if = "Option::is_none")] + pub force_push_allowlist_usernames: Option>, #[serde(rename = "ignore_stale_approvals", skip_serializing_if = "Option::is_none")] pub ignore_stale_approvals: Option, #[serde(rename = "merge_whitelist_teams", skip_serializing_if = "Option::is_none")] pub merge_whitelist_teams: Option>, #[serde(rename = "merge_whitelist_usernames", skip_serializing_if = "Option::is_none")] pub merge_whitelist_usernames: Option>, + /// Priority is the priority of this branch protection rule + #[serde(rename = "priority", skip_serializing_if = "Option::is_none")] + pub priority: Option, #[serde(rename = "protected_file_patterns", skip_serializing_if = "Option::is_none")] pub protected_file_patterns: Option, #[serde(rename = "push_whitelist_deploy_keys", skip_serializing_if = "Option::is_none")] @@ -59,6 +74,7 @@ pub struct BranchProtection { pub require_signed_commits: Option, #[serde(rename = "required_approvals", skip_serializing_if = "Option::is_none")] pub required_approvals: Option, + /// RuleName is the name of the branch protection rule #[serde(rename = "rule_name", skip_serializing_if = "Option::is_none")] pub rule_name: Option, #[serde(rename = "status_check_contexts", skip_serializing_if = "Option::is_none")] @@ -75,6 +91,7 @@ impl BranchProtection { BranchProtection { approvals_whitelist_teams: None, approvals_whitelist_username: None, + block_admin_merge_override: None, block_on_official_review_requests: None, block_on_outdated_branch: None, block_on_rejected_reviews: None, @@ -82,13 +99,19 @@ impl BranchProtection { created_at: None, dismiss_stale_approvals: None, enable_approvals_whitelist: None, + enable_force_push: None, + enable_force_push_allowlist: None, enable_merge_whitelist: None, enable_push: None, enable_push_whitelist: None, enable_status_check: None, + force_push_allowlist_deploy_keys: None, + force_push_allowlist_teams: None, + force_push_allowlist_usernames: None, ignore_stale_approvals: None, merge_whitelist_teams: None, merge_whitelist_usernames: None, + priority: None, protected_file_patterns: None, push_whitelist_deploy_keys: None, push_whitelist_teams: None, diff --git a/crates/gitea-client/src/models/change_file_operation.rs b/crates/gitea-client/src/models/change_file_operation.rs index 8ce1510..41e3c58 100644 --- a/crates/gitea-client/src/models/change_file_operation.rs +++ b/crates/gitea-client/src/models/change_file_operation.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,19 +14,19 @@ use serde::{Deserialize, Serialize}; /// ChangeFileOperation : ChangeFileOperation for creating, updating or deleting a file #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ChangeFileOperation { - /// new or updated file content, must be base64 encoded + /// new or updated file content, it must be base64 encoded #[serde(rename = "content", skip_serializing_if = "Option::is_none")] pub content: Option, /// old path of the file to move #[serde(rename = "from_path", skip_serializing_if = "Option::is_none")] pub from_path: Option, - /// indicates what to do with the file + /// indicates what to do with the file: \"create\" for creating a new file, \"update\" for updating an existing file, \"upload\" for creating or updating a file, \"rename\" for renaming a file, and \"delete\" for deleting an existing file. #[serde(rename = "operation")] pub operation: Operation, /// path to the existing or new file #[serde(rename = "path")] pub path: String, - /// sha is the SHA for the file that already exists, required for update or delete + /// the blob ID (SHA) for the file that already exists, required for changing existing files #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, } @@ -43,13 +43,17 @@ impl ChangeFileOperation { } } } -/// indicates what to do with the file +/// indicates what to do with the file: \"create\" for creating a new file, \"update\" for updating an existing file, \"upload\" for creating or updating a file, \"rename\" for renaming a file, and \"delete\" for deleting an existing file. #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Operation { #[serde(rename = "create")] Create, #[serde(rename = "update")] Update, + #[serde(rename = "upload")] + Upload, + #[serde(rename = "rename")] + Rename, #[serde(rename = "delete")] Delete, } diff --git a/crates/gitea-client/src/models/change_files_options.rs b/crates/gitea-client/src/models/change_files_options.rs index 181a462..7faeeb3 100644 --- a/crates/gitea-client/src/models/change_files_options.rs +++ b/crates/gitea-client/src/models/change_files_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/changed_file.rs b/crates/gitea-client/src/models/changed_file.rs index feb7420..4d065ea 100644 --- a/crates/gitea-client/src/models/changed_file.rs +++ b/crates/gitea-client/src/models/changed_file.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,22 +14,31 @@ use serde::{Deserialize, Serialize}; /// ChangedFile : ChangedFile store information about files affected by the pull request #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ChangedFile { + /// The number of lines added to the file #[serde(rename = "additions", skip_serializing_if = "Option::is_none")] pub additions: Option, + /// The total number of changes to the file #[serde(rename = "changes", skip_serializing_if = "Option::is_none")] pub changes: Option, + /// The API URL to get the file contents #[serde(rename = "contents_url", skip_serializing_if = "Option::is_none")] pub contents_url: Option, + /// The number of lines deleted from the file #[serde(rename = "deletions", skip_serializing_if = "Option::is_none")] pub deletions: Option, + /// The name of the changed file #[serde(rename = "filename", skip_serializing_if = "Option::is_none")] pub filename: Option, + /// The HTML URL to view the file changes #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] pub html_url: Option, + /// The previous filename if the file was renamed #[serde(rename = "previous_filename", skip_serializing_if = "Option::is_none")] pub previous_filename: Option, + /// The raw URL to download the file #[serde(rename = "raw_url", skip_serializing_if = "Option::is_none")] pub raw_url: Option, + /// The status of the file change (added, modified, deleted, etc.) #[serde(rename = "status", skip_serializing_if = "Option::is_none")] pub status: Option, } diff --git a/crates/gitea-client/src/models/combined_status.rs b/crates/gitea-client/src/models/combined_status.rs index e20e6ba..61b9116 100644 --- a/crates/gitea-client/src/models/combined_status.rs +++ b/crates/gitea-client/src/models/combined_status.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,19 +14,24 @@ use serde::{Deserialize, Serialize}; /// CombinedStatus : CombinedStatus holds the combined state of several statuses for a single commit #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CombinedStatus { + /// CommitURL is the API URL for the commit #[serde(rename = "commit_url", skip_serializing_if = "Option::is_none")] pub commit_url: Option, #[serde(rename = "repository", skip_serializing_if = "Option::is_none")] pub repository: Option>, + /// SHA is the commit SHA this status applies to #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, - /// CommitStatusState holds the state of a CommitStatus It can be \"pending\", \"success\", \"error\" and \"failure\" + /// State is the overall combined status state pending CommitStatusPending CommitStatusPending is for when the CommitStatus is Pending success CommitStatusSuccess CommitStatusSuccess is for when the CommitStatus is Success error CommitStatusError CommitStatusError is for when the CommitStatus is Error failure CommitStatusFailure CommitStatusFailure is for when the CommitStatus is Failure warning CommitStatusWarning CommitStatusWarning is for when the CommitStatus is Warning skipped CommitStatusSkipped CommitStatusSkipped is for when CommitStatus is Skipped #[serde(rename = "state", skip_serializing_if = "Option::is_none")] - pub state: Option, + pub state: Option, + /// Statuses contains all individual commit statuses #[serde(rename = "statuses", skip_serializing_if = "Option::is_none")] pub statuses: Option>, + /// TotalCount is the total number of statuses #[serde(rename = "total_count", skip_serializing_if = "Option::is_none")] pub total_count: Option, + /// URL is the API URL for this combined status #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } @@ -45,4 +50,26 @@ impl CombinedStatus { } } } +/// State is the overall combined status state pending CommitStatusPending CommitStatusPending is for when the CommitStatus is Pending success CommitStatusSuccess CommitStatusSuccess is for when the CommitStatus is Success error CommitStatusError CommitStatusError is for when the CommitStatus is Error failure CommitStatusFailure CommitStatusFailure is for when the CommitStatus is Failure warning CommitStatusWarning CommitStatusWarning is for when the CommitStatus is Warning skipped CommitStatusSkipped CommitStatusSkipped is for when CommitStatus is Skipped +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum State { + #[serde(rename = "pending")] + Pending, + #[serde(rename = "success")] + Success, + #[serde(rename = "error")] + Error, + #[serde(rename = "failure")] + Failure, + #[serde(rename = "warning")] + Warning, + #[serde(rename = "skipped")] + Skipped, +} + +impl Default for State { + fn default() -> State { + Self::Pending + } +} diff --git a/crates/gitea-client/src/models/comment.rs b/crates/gitea-client/src/models/comment.rs index 01c0589..a76a28f 100644 --- a/crates/gitea-client/src/models/comment.rs +++ b/crates/gitea-client/src/models/comment.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,22 +14,30 @@ use serde::{Deserialize, Serialize}; /// Comment : Comment represents a comment on a commit or issue #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Comment { + /// Attachments contains files attached to the comment #[serde(rename = "assets", skip_serializing_if = "Option::is_none")] pub assets: Option>, + /// Body contains the comment text content #[serde(rename = "body", skip_serializing_if = "Option::is_none")] pub body: Option, #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, + /// HTMLURL is the web URL for viewing the comment #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] pub html_url: Option, + /// ID is the unique identifier for the comment #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// IssueURL is the API URL for the issue #[serde(rename = "issue_url", skip_serializing_if = "Option::is_none")] pub issue_url: Option, + /// OriginalAuthor is the original author name (for imported comments) #[serde(rename = "original_author", skip_serializing_if = "Option::is_none")] pub original_author: Option, + /// OriginalAuthorID is the original author ID (for imported comments) #[serde(rename = "original_author_id", skip_serializing_if = "Option::is_none")] pub original_author_id: Option, + /// PRURL is the API URL for the pull request (if applicable) #[serde(rename = "pull_request_url", skip_serializing_if = "Option::is_none")] pub pull_request_url: Option, #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/commit.rs b/crates/gitea-client/src/models/commit.rs index 75a0441..22d110b 100644 --- a/crates/gitea-client/src/models/commit.rs +++ b/crates/gitea-client/src/models/commit.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -21,16 +21,21 @@ pub struct Commit { pub committer: Option>, #[serde(rename = "created", skip_serializing_if = "Option::is_none")] pub created: Option, + /// Files contains information about files affected by the commit #[serde(rename = "files", skip_serializing_if = "Option::is_none")] pub files: Option>, + /// HTMLURL is the web URL for viewing the commit #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] pub html_url: Option, + /// Parents contains the parent commit information #[serde(rename = "parents", skip_serializing_if = "Option::is_none")] pub parents: Option>, + /// SHA is the commit SHA hash #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, #[serde(rename = "stats", skip_serializing_if = "Option::is_none")] pub stats: Option>, + /// URL is the API URL for the commit #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/commit_affected_files.rs b/crates/gitea-client/src/models/commit_affected_files.rs index c453c92..99631ac 100644 --- a/crates/gitea-client/src/models/commit_affected_files.rs +++ b/crates/gitea-client/src/models/commit_affected_files.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,8 +14,10 @@ use serde::{Deserialize, Serialize}; /// CommitAffectedFiles : CommitAffectedFiles store information about files affected by the commit #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CommitAffectedFiles { + /// Filename is the path of the affected file #[serde(rename = "filename", skip_serializing_if = "Option::is_none")] pub filename: Option, + /// Status indicates how the file was affected (added, modified, deleted) #[serde(rename = "status", skip_serializing_if = "Option::is_none")] pub status: Option, } diff --git a/crates/gitea-client/src/models/commit_date_options.rs b/crates/gitea-client/src/models/commit_date_options.rs index ade1d30..7697e57 100644 --- a/crates/gitea-client/src/models/commit_date_options.rs +++ b/crates/gitea-client/src/models/commit_date_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/commit_meta.rs b/crates/gitea-client/src/models/commit_meta.rs index e091d75..45d989b 100644 --- a/crates/gitea-client/src/models/commit_meta.rs +++ b/crates/gitea-client/src/models/commit_meta.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -15,8 +15,10 @@ use serde::{Deserialize, Serialize}; pub struct CommitMeta { #[serde(rename = "created", skip_serializing_if = "Option::is_none")] pub created: Option, + /// SHA is the commit SHA hash #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, + /// URL is the API URL for the commit #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/commit_stats.rs b/crates/gitea-client/src/models/commit_stats.rs index 8471648..49681c4 100644 --- a/crates/gitea-client/src/models/commit_stats.rs +++ b/crates/gitea-client/src/models/commit_stats.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,10 +14,13 @@ use serde::{Deserialize, Serialize}; /// CommitStats : CommitStats is statistics for a RepoCommit #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CommitStats { + /// Additions is the number of lines added #[serde(rename = "additions", skip_serializing_if = "Option::is_none")] pub additions: Option, + /// Deletions is the number of lines deleted #[serde(rename = "deletions", skip_serializing_if = "Option::is_none")] pub deletions: Option, + /// Total is the total number of lines changed #[serde(rename = "total", skip_serializing_if = "Option::is_none")] pub total: Option, } diff --git a/crates/gitea-client/src/models/commit_status.rs b/crates/gitea-client/src/models/commit_status.rs index 657bf04..ecea7f7 100644 --- a/crates/gitea-client/src/models/commit_status.rs +++ b/crates/gitea-client/src/models/commit_status.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,23 +14,28 @@ use serde::{Deserialize, Serialize}; /// CommitStatus : CommitStatus holds a single status of a single Commit #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CommitStatus { + /// Context is the unique context identifier for the status #[serde(rename = "context", skip_serializing_if = "Option::is_none")] pub context: Option, #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, #[serde(rename = "creator", skip_serializing_if = "Option::is_none")] pub creator: Option>, + /// Description provides a brief description of the status #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, + /// ID is the unique identifier for the commit status #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - /// CommitStatusState holds the state of a CommitStatus It can be \"pending\", \"success\", \"error\" and \"failure\" + /// State represents the status state (pending, success, error, failure) pending CommitStatusPending CommitStatusPending is for when the CommitStatus is Pending success CommitStatusSuccess CommitStatusSuccess is for when the CommitStatus is Success error CommitStatusError CommitStatusError is for when the CommitStatus is Error failure CommitStatusFailure CommitStatusFailure is for when the CommitStatus is Failure warning CommitStatusWarning CommitStatusWarning is for when the CommitStatus is Warning skipped CommitStatusSkipped CommitStatusSkipped is for when CommitStatus is Skipped #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, + /// TargetURL is the URL to link to for more details #[serde(rename = "target_url", skip_serializing_if = "Option::is_none")] pub target_url: Option, #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] pub updated_at: Option, + /// URL is the API URL for this status #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } @@ -51,4 +56,26 @@ impl CommitStatus { } } } +/// State represents the status state (pending, success, error, failure) pending CommitStatusPending CommitStatusPending is for when the CommitStatus is Pending success CommitStatusSuccess CommitStatusSuccess is for when the CommitStatus is Success error CommitStatusError CommitStatusError is for when the CommitStatus is Error failure CommitStatusFailure CommitStatusFailure is for when the CommitStatus is Failure warning CommitStatusWarning CommitStatusWarning is for when the CommitStatus is Warning skipped CommitStatusSkipped CommitStatusSkipped is for when CommitStatus is Skipped +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "pending")] + Pending, + #[serde(rename = "success")] + Success, + #[serde(rename = "error")] + Error, + #[serde(rename = "failure")] + Failure, + #[serde(rename = "warning")] + Warning, + #[serde(rename = "skipped")] + Skipped, +} + +impl Default for Status { + fn default() -> Status { + Self::Pending + } +} diff --git a/crates/gitea-client/src/models/commit_user.rs b/crates/gitea-client/src/models/commit_user.rs index fdc9757..01acac1 100644 --- a/crates/gitea-client/src/models/commit_user.rs +++ b/crates/gitea-client/src/models/commit_user.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -13,10 +13,12 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CommitUser { + /// Date is the commit date in string format #[serde(rename = "date", skip_serializing_if = "Option::is_none")] pub date: Option, #[serde(rename = "email", skip_serializing_if = "Option::is_none")] pub email: Option, + /// Name is the person's name #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, } diff --git a/crates/gitea-client/src/models/compare.rs b/crates/gitea-client/src/models/compare.rs index 3c918c1..71d1183 100644 --- a/crates/gitea-client/src/models/compare.rs +++ b/crates/gitea-client/src/models/compare.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/contents_ext_response.rs b/crates/gitea-client/src/models/contents_ext_response.rs new file mode 100644 index 0000000..343aee0 --- /dev/null +++ b/crates/gitea-client/src/models/contents_ext_response.rs @@ -0,0 +1,31 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContentsExtResponse { + /// DirContents contains directory listing when the path represents a directory + #[serde(rename = "dir_contents", skip_serializing_if = "Option::is_none")] + pub dir_contents: Option>, + #[serde(rename = "file_contents", skip_serializing_if = "Option::is_none")] + pub file_contents: Option>, +} + +impl ContentsExtResponse { + pub fn new() -> ContentsExtResponse { + ContentsExtResponse { + dir_contents: None, + file_contents: None, + } + } +} + diff --git a/crates/gitea-client/src/models/contents_response.rs b/crates/gitea-client/src/models/contents_response.rs index b102c0a..e70b4ca 100644 --- a/crates/gitea-client/src/models/contents_response.rs +++ b/crates/gitea-client/src/models/contents_response.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -19,23 +19,44 @@ pub struct ContentsResponse { /// `content` is populated when `type` is `file`, otherwise null #[serde(rename = "content", skip_serializing_if = "Option::is_none")] pub content: Option, + /// DownloadURL is the direct download URL for this file #[serde(rename = "download_url", skip_serializing_if = "Option::is_none")] pub download_url: Option, /// `encoding` is populated when `type` is `file`, otherwise null #[serde(rename = "encoding", skip_serializing_if = "Option::is_none")] pub encoding: Option, + /// GitURL is the Git API URL for this blob or tree #[serde(rename = "git_url", skip_serializing_if = "Option::is_none")] pub git_url: Option, + /// HTMLURL is the web URL for this file or directory #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] pub html_url: Option, + #[serde(rename = "last_author_date", skip_serializing_if = "Option::is_none")] + pub last_author_date: Option, + /// LastCommitMessage is the message of the last commit that affected this file + #[serde(rename = "last_commit_message", skip_serializing_if = "Option::is_none")] + pub last_commit_message: Option, + /// LastCommitSHA is the SHA of the last commit that affected this file #[serde(rename = "last_commit_sha", skip_serializing_if = "Option::is_none")] pub last_commit_sha: Option, + #[serde(rename = "last_committer_date", skip_serializing_if = "Option::is_none")] + pub last_committer_date: Option, + /// LfsOid is the Git LFS object ID if this file is stored in LFS + #[serde(rename = "lfs_oid", skip_serializing_if = "Option::is_none")] + pub lfs_oid: Option, + /// LfsSize is the file size if this file is stored in LFS + #[serde(rename = "lfs_size", skip_serializing_if = "Option::is_none")] + pub lfs_size: Option, + /// Name is the file or directory name #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// Path is the full path to the file or directory #[serde(rename = "path", skip_serializing_if = "Option::is_none")] pub path: Option, + /// SHA is the Git blob or tree SHA #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, + /// Size is the file size in bytes #[serde(rename = "size", skip_serializing_if = "Option::is_none")] pub size: Option, /// `submodule_git_url` is populated when `type` is `submodule`, otherwise null @@ -47,6 +68,7 @@ pub struct ContentsResponse { /// `type` will be `file`, `dir`, `symlink`, or `submodule` #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub r#type: Option, + /// URL is the API URL for this file or directory #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } @@ -61,7 +83,12 @@ impl ContentsResponse { encoding: None, git_url: None, html_url: None, + last_author_date: None, + last_commit_message: None, last_commit_sha: None, + last_committer_date: None, + lfs_oid: None, + lfs_size: None, name: None, path: None, sha: None, diff --git a/crates/gitea-client/src/models/create_access_token_option.rs b/crates/gitea-client/src/models/create_access_token_option.rs index c3bfa44..fee428f 100644 --- a/crates/gitea-client/src/models/create_access_token_option.rs +++ b/crates/gitea-client/src/models/create_access_token_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/create_action_workflow_dispatch.rs b/crates/gitea-client/src/models/create_action_workflow_dispatch.rs new file mode 100644 index 0000000..0989c8d --- /dev/null +++ b/crates/gitea-client/src/models/create_action_workflow_dispatch.rs @@ -0,0 +1,32 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// CreateActionWorkflowDispatch : CreateActionWorkflowDispatch represents the payload for triggering a workflow dispatch event +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateActionWorkflowDispatch { + #[serde(rename = "inputs", skip_serializing_if = "Option::is_none")] + pub inputs: Option>, + #[serde(rename = "ref")] + pub r#ref: String, +} + +impl CreateActionWorkflowDispatch { + /// CreateActionWorkflowDispatch represents the payload for triggering a workflow dispatch event + pub fn new(r#ref: String) -> CreateActionWorkflowDispatch { + CreateActionWorkflowDispatch { + inputs: None, + r#ref, + } + } +} + diff --git a/crates/gitea-client/src/models/create_branch_protection_option.rs b/crates/gitea-client/src/models/create_branch_protection_option.rs index be58e36..0ed9ade 100644 --- a/crates/gitea-client/src/models/create_branch_protection_option.rs +++ b/crates/gitea-client/src/models/create_branch_protection_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -18,6 +18,8 @@ pub struct CreateBranchProtectionOption { pub approvals_whitelist_teams: Option>, #[serde(rename = "approvals_whitelist_username", skip_serializing_if = "Option::is_none")] pub approvals_whitelist_username: Option>, + #[serde(rename = "block_admin_merge_override", skip_serializing_if = "Option::is_none")] + pub block_admin_merge_override: Option, #[serde(rename = "block_on_official_review_requests", skip_serializing_if = "Option::is_none")] pub block_on_official_review_requests: Option, #[serde(rename = "block_on_outdated_branch", skip_serializing_if = "Option::is_none")] @@ -31,6 +33,10 @@ pub struct CreateBranchProtectionOption { pub dismiss_stale_approvals: Option, #[serde(rename = "enable_approvals_whitelist", skip_serializing_if = "Option::is_none")] pub enable_approvals_whitelist: Option, + #[serde(rename = "enable_force_push", skip_serializing_if = "Option::is_none")] + pub enable_force_push: Option, + #[serde(rename = "enable_force_push_allowlist", skip_serializing_if = "Option::is_none")] + pub enable_force_push_allowlist: Option, #[serde(rename = "enable_merge_whitelist", skip_serializing_if = "Option::is_none")] pub enable_merge_whitelist: Option, #[serde(rename = "enable_push", skip_serializing_if = "Option::is_none")] @@ -39,12 +45,20 @@ pub struct CreateBranchProtectionOption { pub enable_push_whitelist: Option, #[serde(rename = "enable_status_check", skip_serializing_if = "Option::is_none")] pub enable_status_check: Option, + #[serde(rename = "force_push_allowlist_deploy_keys", skip_serializing_if = "Option::is_none")] + pub force_push_allowlist_deploy_keys: Option, + #[serde(rename = "force_push_allowlist_teams", skip_serializing_if = "Option::is_none")] + pub force_push_allowlist_teams: Option>, + #[serde(rename = "force_push_allowlist_usernames", skip_serializing_if = "Option::is_none")] + pub force_push_allowlist_usernames: Option>, #[serde(rename = "ignore_stale_approvals", skip_serializing_if = "Option::is_none")] pub ignore_stale_approvals: Option, #[serde(rename = "merge_whitelist_teams", skip_serializing_if = "Option::is_none")] pub merge_whitelist_teams: Option>, #[serde(rename = "merge_whitelist_usernames", skip_serializing_if = "Option::is_none")] pub merge_whitelist_usernames: Option>, + #[serde(rename = "priority", skip_serializing_if = "Option::is_none")] + pub priority: Option, #[serde(rename = "protected_file_patterns", skip_serializing_if = "Option::is_none")] pub protected_file_patterns: Option, #[serde(rename = "push_whitelist_deploy_keys", skip_serializing_if = "Option::is_none")] @@ -71,19 +85,26 @@ impl CreateBranchProtectionOption { CreateBranchProtectionOption { approvals_whitelist_teams: None, approvals_whitelist_username: None, + block_admin_merge_override: None, block_on_official_review_requests: None, block_on_outdated_branch: None, block_on_rejected_reviews: None, branch_name: None, dismiss_stale_approvals: None, enable_approvals_whitelist: None, + enable_force_push: None, + enable_force_push_allowlist: None, enable_merge_whitelist: None, enable_push: None, enable_push_whitelist: None, enable_status_check: None, + force_push_allowlist_deploy_keys: None, + force_push_allowlist_teams: None, + force_push_allowlist_usernames: None, ignore_stale_approvals: None, merge_whitelist_teams: None, merge_whitelist_usernames: None, + priority: None, protected_file_patterns: None, push_whitelist_deploy_keys: None, push_whitelist_teams: None, diff --git a/crates/gitea-client/src/models/create_branch_repo_option.rs b/crates/gitea-client/src/models/create_branch_repo_option.rs index e23d734..b366a26 100644 --- a/crates/gitea-client/src/models/create_branch_repo_option.rs +++ b/crates/gitea-client/src/models/create_branch_repo_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/create_email_option.rs b/crates/gitea-client/src/models/create_email_option.rs index acf50fe..7415679 100644 --- a/crates/gitea-client/src/models/create_email_option.rs +++ b/crates/gitea-client/src/models/create_email_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/create_file_options.rs b/crates/gitea-client/src/models/create_file_options.rs index aded0cc..6405ffe 100644 --- a/crates/gitea-client/src/models/create_file_options.rs +++ b/crates/gitea-client/src/models/create_file_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/create_fork_option.rs b/crates/gitea-client/src/models/create_fork_option.rs index 1dc5061..d16d82d 100644 --- a/crates/gitea-client/src/models/create_fork_option.rs +++ b/crates/gitea-client/src/models/create_fork_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/create_gpg_key_option.rs b/crates/gitea-client/src/models/create_gpg_key_option.rs index 7f1573a..ad3d9aa 100644 --- a/crates/gitea-client/src/models/create_gpg_key_option.rs +++ b/crates/gitea-client/src/models/create_gpg_key_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -17,6 +17,7 @@ pub struct CreateGpgKeyOption { /// An armored GPG key to add #[serde(rename = "armored_public_key")] pub armored_public_key: String, + /// An optional armored signature for the GPG key #[serde(rename = "armored_signature", skip_serializing_if = "Option::is_none")] pub armored_signature: Option, } diff --git a/crates/gitea-client/src/models/create_hook_option.rs b/crates/gitea-client/src/models/create_hook_option.rs index 1de83ce..6a2c5a1 100644 --- a/crates/gitea-client/src/models/create_hook_option.rs +++ b/crates/gitea-client/src/models/create_hook_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,13 +16,16 @@ use serde::{Deserialize, Serialize}; pub struct CreateHookOption { #[serde(rename = "active", skip_serializing_if = "Option::is_none")] pub active: Option, + /// Authorization header to include in webhook requests #[serde(rename = "authorization_header", skip_serializing_if = "Option::is_none")] pub authorization_header: Option, + /// Branch filter pattern to determine which branches trigger the webhook #[serde(rename = "branch_filter", skip_serializing_if = "Option::is_none")] pub branch_filter: Option, /// CreateHookOptionConfig has all config options in it required are \"content_type\" and \"url\" Required #[serde(rename = "config")] pub config: std::collections::HashMap, + /// List of events that will trigger this webhook #[serde(rename = "events", skip_serializing_if = "Option::is_none")] pub events: Option>, #[serde(rename = "type")] diff --git a/crates/gitea-client/src/models/create_issue_comment_option.rs b/crates/gitea-client/src/models/create_issue_comment_option.rs index bad2be0..c9d126a 100644 --- a/crates/gitea-client/src/models/create_issue_comment_option.rs +++ b/crates/gitea-client/src/models/create_issue_comment_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/create_issue_option.rs b/crates/gitea-client/src/models/create_issue_option.rs index bb25355..c1502c6 100644 --- a/crates/gitea-client/src/models/create_issue_option.rs +++ b/crates/gitea-client/src/models/create_issue_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/create_key_option.rs b/crates/gitea-client/src/models/create_key_option.rs index ab2c3ec..fae731c 100644 --- a/crates/gitea-client/src/models/create_key_option.rs +++ b/crates/gitea-client/src/models/create_key_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/create_label_option.rs b/crates/gitea-client/src/models/create_label_option.rs index 61bdbd2..3766ab9 100644 --- a/crates/gitea-client/src/models/create_label_option.rs +++ b/crates/gitea-client/src/models/create_label_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,6 +16,7 @@ use serde::{Deserialize, Serialize}; pub struct CreateLabelOption { #[serde(rename = "color")] pub color: String, + /// Description provides additional context about the label's purpose #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(rename = "exclusive", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/create_milestone_option.rs b/crates/gitea-client/src/models/create_milestone_option.rs index c898d08..1b94c56 100644 --- a/crates/gitea-client/src/models/create_milestone_option.rs +++ b/crates/gitea-client/src/models/create_milestone_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,12 +14,14 @@ use serde::{Deserialize, Serialize}; /// CreateMilestoneOption : CreateMilestoneOption options for creating a milestone #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateMilestoneOption { + /// Description provides details about the milestone #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(rename = "due_on", skip_serializing_if = "Option::is_none")] pub due_on: Option, #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option, + /// Title is the title of the new milestone #[serde(rename = "title", skip_serializing_if = "Option::is_none")] pub title: Option, } diff --git a/crates/gitea-client/src/models/create_o_auth2_application_options.rs b/crates/gitea-client/src/models/create_o_auth2_application_options.rs index 7f37387..90e34cd 100644 --- a/crates/gitea-client/src/models/create_o_auth2_application_options.rs +++ b/crates/gitea-client/src/models/create_o_auth2_application_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,12 +14,18 @@ use serde::{Deserialize, Serialize}; /// CreateOAuth2ApplicationOptions : CreateOAuth2ApplicationOptions holds options to create an oauth2 application #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateOAuth2ApplicationOptions { + /// Whether the client is confidential #[serde(rename = "confidential_client", skip_serializing_if = "Option::is_none")] pub confidential_client: Option, + /// The name of the OAuth2 application #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// The list of allowed redirect URIs #[serde(rename = "redirect_uris", skip_serializing_if = "Option::is_none")] pub redirect_uris: Option>, + /// Whether to skip secondary authorization + #[serde(rename = "skip_secondary_authorization", skip_serializing_if = "Option::is_none")] + pub skip_secondary_authorization: Option, } impl CreateOAuth2ApplicationOptions { @@ -29,6 +35,7 @@ impl CreateOAuth2ApplicationOptions { confidential_client: None, name: None, redirect_uris: None, + skip_secondary_authorization: None, } } } diff --git a/crates/gitea-client/src/models/create_or_update_secret_option.rs b/crates/gitea-client/src/models/create_or_update_secret_option.rs index 70eb525..a8a3d13 100644 --- a/crates/gitea-client/src/models/create_or_update_secret_option.rs +++ b/crates/gitea-client/src/models/create_or_update_secret_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -17,6 +17,9 @@ pub struct CreateOrUpdateSecretOption { /// Data of the secret to update #[serde(rename = "data")] pub data: String, + /// Description of the secret to update + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, } impl CreateOrUpdateSecretOption { @@ -24,6 +27,7 @@ impl CreateOrUpdateSecretOption { pub fn new(data: String) -> CreateOrUpdateSecretOption { CreateOrUpdateSecretOption { data, + description: None, } } } diff --git a/crates/gitea-client/src/models/create_org_option.rs b/crates/gitea-client/src/models/create_org_option.rs index 3b79ade..12f6873 100644 --- a/crates/gitea-client/src/models/create_org_option.rs +++ b/crates/gitea-client/src/models/create_org_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,21 +14,28 @@ use serde::{Deserialize, Serialize}; /// CreateOrgOption : CreateOrgOption options for creating an organization #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateOrgOption { + /// The description of the organization #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, + /// The email address of the organization #[serde(rename = "email", skip_serializing_if = "Option::is_none")] pub email: Option, + /// The full display name of the organization #[serde(rename = "full_name", skip_serializing_if = "Option::is_none")] pub full_name: Option, + /// The location of the organization #[serde(rename = "location", skip_serializing_if = "Option::is_none")] pub location: Option, + /// Whether repository administrators can change team access #[serde(rename = "repo_admin_change_team_access", skip_serializing_if = "Option::is_none")] pub repo_admin_change_team_access: Option, + /// username of the organization #[serde(rename = "username")] pub username: String, /// possible values are `public` (default), `limited` or `private` #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, + /// The website URL of the organization #[serde(rename = "website", skip_serializing_if = "Option::is_none")] pub website: Option, } diff --git a/crates/gitea-client/src/models/create_pull_request_option.rs b/crates/gitea-client/src/models/create_pull_request_option.rs index e4bd33b..4531d3e 100644 --- a/crates/gitea-client/src/models/create_pull_request_option.rs +++ b/crates/gitea-client/src/models/create_pull_request_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,22 +14,36 @@ use serde::{Deserialize, Serialize}; /// CreatePullRequestOption : CreatePullRequestOption options when creating a pull request #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreatePullRequestOption { + /// The primary assignee username #[serde(rename = "assignee", skip_serializing_if = "Option::is_none")] pub assignee: Option, + /// The list of assignee usernames #[serde(rename = "assignees", skip_serializing_if = "Option::is_none")] pub assignees: Option>, + /// The base branch for the pull request #[serde(rename = "base", skip_serializing_if = "Option::is_none")] pub base: Option, + /// The description body of the pull request #[serde(rename = "body", skip_serializing_if = "Option::is_none")] pub body: Option, #[serde(rename = "due_date", skip_serializing_if = "Option::is_none")] pub due_date: Option, + /// The head branch for the pull request, it could be a branch name on the base repository or a form like `:` which refers to the user's fork repository's branch. #[serde(rename = "head", skip_serializing_if = "Option::is_none")] pub head: Option, + /// The list of label IDs to assign to the pull request #[serde(rename = "labels", skip_serializing_if = "Option::is_none")] pub labels: Option>, + /// The milestone ID to assign to the pull request #[serde(rename = "milestone", skip_serializing_if = "Option::is_none")] pub milestone: Option, + /// The list of reviewer usernames + #[serde(rename = "reviewers", skip_serializing_if = "Option::is_none")] + pub reviewers: Option>, + /// The list of team reviewer names + #[serde(rename = "team_reviewers", skip_serializing_if = "Option::is_none")] + pub team_reviewers: Option>, + /// The title of the pull request #[serde(rename = "title", skip_serializing_if = "Option::is_none")] pub title: Option, } @@ -46,6 +60,8 @@ impl CreatePullRequestOption { head: None, labels: None, milestone: None, + reviewers: None, + team_reviewers: None, title: None, } } diff --git a/crates/gitea-client/src/models/create_pull_review_comment.rs b/crates/gitea-client/src/models/create_pull_review_comment.rs index c12fee3..73a2302 100644 --- a/crates/gitea-client/src/models/create_pull_review_comment.rs +++ b/crates/gitea-client/src/models/create_pull_review_comment.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/create_pull_review_options.rs b/crates/gitea-client/src/models/create_pull_review_options.rs index 9b8279e..0aa7ae4 100644 --- a/crates/gitea-client/src/models/create_pull_review_options.rs +++ b/crates/gitea-client/src/models/create_pull_review_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/create_push_mirror_option.rs b/crates/gitea-client/src/models/create_push_mirror_option.rs index 6589a0c..923dfbf 100644 --- a/crates/gitea-client/src/models/create_push_mirror_option.rs +++ b/crates/gitea-client/src/models/create_push_mirror_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -13,14 +13,19 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreatePushMirrorOption { + /// The sync interval for automatic updates #[serde(rename = "interval", skip_serializing_if = "Option::is_none")] pub interval: Option, + /// The remote repository URL to push to #[serde(rename = "remote_address", skip_serializing_if = "Option::is_none")] pub remote_address: Option, + /// The password for authentication with the remote repository #[serde(rename = "remote_password", skip_serializing_if = "Option::is_none")] pub remote_password: Option, + /// The username for authentication with the remote repository #[serde(rename = "remote_username", skip_serializing_if = "Option::is_none")] pub remote_username: Option, + /// Whether to sync on every commit #[serde(rename = "sync_on_commit", skip_serializing_if = "Option::is_none")] pub sync_on_commit: Option, } diff --git a/crates/gitea-client/src/models/create_release_option.rs b/crates/gitea-client/src/models/create_release_option.rs index 1bf7841..228b290 100644 --- a/crates/gitea-client/src/models/create_release_option.rs +++ b/crates/gitea-client/src/models/create_release_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,16 +14,24 @@ use serde::{Deserialize, Serialize}; /// CreateReleaseOption : CreateReleaseOption options when creating a release #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateReleaseOption { + /// The release notes or description #[serde(rename = "body", skip_serializing_if = "Option::is_none")] pub body: Option, + /// Whether to create the release as a draft #[serde(rename = "draft", skip_serializing_if = "Option::is_none")] pub draft: Option, + /// The display title of the release #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// Whether to mark the release as a prerelease #[serde(rename = "prerelease", skip_serializing_if = "Option::is_none")] pub prerelease: Option, + /// The message for the git tag + #[serde(rename = "tag_message", skip_serializing_if = "Option::is_none")] + pub tag_message: Option, #[serde(rename = "tag_name")] pub tag_name: String, + /// The target commitish for the release #[serde(rename = "target_commitish", skip_serializing_if = "Option::is_none")] pub target_commitish: Option, } @@ -36,6 +44,7 @@ impl CreateReleaseOption { draft: None, name: None, prerelease: None, + tag_message: None, tag_name, target_commitish: None, } diff --git a/crates/gitea-client/src/models/create_repo_option.rs b/crates/gitea-client/src/models/create_repo_option.rs index 69118cc..5009e75 100644 --- a/crates/gitea-client/src/models/create_repo_option.rs +++ b/crates/gitea-client/src/models/create_repo_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/create_status_option.rs b/crates/gitea-client/src/models/create_status_option.rs index db202c7..0022aac 100644 --- a/crates/gitea-client/src/models/create_status_option.rs +++ b/crates/gitea-client/src/models/create_status_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,13 +14,16 @@ use serde::{Deserialize, Serialize}; /// CreateStatusOption : CreateStatusOption holds the information needed to create a new CommitStatus for a Commit #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateStatusOption { + /// Context is the unique context identifier for the status #[serde(rename = "context", skip_serializing_if = "Option::is_none")] pub context: Option, + /// Description provides a brief description of the status #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, - /// CommitStatusState holds the state of a CommitStatus It can be \"pending\", \"success\", \"error\" and \"failure\" + /// State represents the status state to set (pending, success, error, failure) pending CommitStatusPending CommitStatusPending is for when the CommitStatus is Pending success CommitStatusSuccess CommitStatusSuccess is for when the CommitStatus is Success error CommitStatusError CommitStatusError is for when the CommitStatus is Error failure CommitStatusFailure CommitStatusFailure is for when the CommitStatus is Failure warning CommitStatusWarning CommitStatusWarning is for when the CommitStatus is Warning skipped CommitStatusSkipped CommitStatusSkipped is for when CommitStatus is Skipped #[serde(rename = "state", skip_serializing_if = "Option::is_none")] - pub state: Option, + pub state: Option, + /// TargetURL is the URL to link to for more details #[serde(rename = "target_url", skip_serializing_if = "Option::is_none")] pub target_url: Option, } @@ -36,4 +39,26 @@ impl CreateStatusOption { } } } +/// State represents the status state to set (pending, success, error, failure) pending CommitStatusPending CommitStatusPending is for when the CommitStatus is Pending success CommitStatusSuccess CommitStatusSuccess is for when the CommitStatus is Success error CommitStatusError CommitStatusError is for when the CommitStatus is Error failure CommitStatusFailure CommitStatusFailure is for when the CommitStatus is Failure warning CommitStatusWarning CommitStatusWarning is for when the CommitStatus is Warning skipped CommitStatusSkipped CommitStatusSkipped is for when CommitStatus is Skipped +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum State { + #[serde(rename = "pending")] + Pending, + #[serde(rename = "success")] + Success, + #[serde(rename = "error")] + Error, + #[serde(rename = "failure")] + Failure, + #[serde(rename = "warning")] + Warning, + #[serde(rename = "skipped")] + Skipped, +} + +impl Default for State { + fn default() -> State { + Self::Pending + } +} diff --git a/crates/gitea-client/src/models/create_tag_option.rs b/crates/gitea-client/src/models/create_tag_option.rs index 2f374f6..1043961 100644 --- a/crates/gitea-client/src/models/create_tag_option.rs +++ b/crates/gitea-client/src/models/create_tag_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,10 +14,12 @@ use serde::{Deserialize, Serialize}; /// CreateTagOption : CreateTagOption options when creating a tag #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateTagOption { + /// The message to associate with the tag #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, #[serde(rename = "tag_name")] pub tag_name: String, + /// The target commit SHA or branch name for the tag #[serde(rename = "target", skip_serializing_if = "Option::is_none")] pub target: Option, } diff --git a/crates/gitea-client/src/models/create_tag_protection_option.rs b/crates/gitea-client/src/models/create_tag_protection_option.rs new file mode 100644 index 0000000..77afe51 --- /dev/null +++ b/crates/gitea-client/src/models/create_tag_protection_option.rs @@ -0,0 +1,38 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// CreateTagProtectionOption : CreateTagProtectionOption options for creating a tag protection +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateTagProtectionOption { + /// The pattern to match tag names for protection + #[serde(rename = "name_pattern", skip_serializing_if = "Option::is_none")] + pub name_pattern: Option, + /// List of team names allowed to create/delete protected tags + #[serde(rename = "whitelist_teams", skip_serializing_if = "Option::is_none")] + pub whitelist_teams: Option>, + /// List of usernames allowed to create/delete protected tags + #[serde(rename = "whitelist_usernames", skip_serializing_if = "Option::is_none")] + pub whitelist_usernames: Option>, +} + +impl CreateTagProtectionOption { + /// CreateTagProtectionOption options for creating a tag protection + pub fn new() -> CreateTagProtectionOption { + CreateTagProtectionOption { + name_pattern: None, + whitelist_teams: None, + whitelist_usernames: None, + } + } +} + diff --git a/crates/gitea-client/src/models/create_team_option.rs b/crates/gitea-client/src/models/create_team_option.rs index 8185e3f..fb6ed9b 100644 --- a/crates/gitea-client/src/models/create_team_option.rs +++ b/crates/gitea-client/src/models/create_team_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,10 +14,13 @@ use serde::{Deserialize, Serialize}; /// CreateTeamOption : CreateTeamOption options for creating a team #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateTeamOption { + /// Whether the team can create repositories in the organization #[serde(rename = "can_create_org_repo", skip_serializing_if = "Option::is_none")] pub can_create_org_repo: Option, + /// The description of the team #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, + /// Whether the team has access to all repositories in the organization #[serde(rename = "includes_all_repositories", skip_serializing_if = "Option::is_none")] pub includes_all_repositories: Option, #[serde(rename = "name")] diff --git a/crates/gitea-client/src/models/create_user_option.rs b/crates/gitea-client/src/models/create_user_option.rs index ed947e8..40d1cab 100644 --- a/crates/gitea-client/src/models/create_user_option.rs +++ b/crates/gitea-client/src/models/create_user_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -19,22 +19,31 @@ pub struct CreateUserOption { pub created_at: Option, #[serde(rename = "email")] pub email: String, + /// The full display name of the user #[serde(rename = "full_name", skip_serializing_if = "Option::is_none")] pub full_name: Option, + /// identifier of the user, provided by the external authenticator (if configured) #[serde(rename = "login_name", skip_serializing_if = "Option::is_none")] pub login_name: Option, + /// Whether the user must change password on first login #[serde(rename = "must_change_password", skip_serializing_if = "Option::is_none")] pub must_change_password: Option, + /// The plain text password for the user #[serde(rename = "password", skip_serializing_if = "Option::is_none")] pub password: Option, + /// Whether the user has restricted access privileges #[serde(rename = "restricted", skip_serializing_if = "Option::is_none")] pub restricted: Option, + /// Whether to send welcome notification email to the user #[serde(rename = "send_notify", skip_serializing_if = "Option::is_none")] pub send_notify: Option, + /// The authentication source ID to associate with the user #[serde(rename = "source_id", skip_serializing_if = "Option::is_none")] pub source_id: Option, + /// username of the user #[serde(rename = "username")] pub username: String, + /// User visibility level: public, limited, or private #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, } diff --git a/crates/gitea-client/src/models/create_variable_option.rs b/crates/gitea-client/src/models/create_variable_option.rs index 5803000..cd8af1e 100644 --- a/crates/gitea-client/src/models/create_variable_option.rs +++ b/crates/gitea-client/src/models/create_variable_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,6 +14,9 @@ use serde::{Deserialize, Serialize}; /// CreateVariableOption : CreateVariableOption the option when creating variable #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateVariableOption { + /// Description of the variable to create + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, /// Value of the variable to create #[serde(rename = "value")] pub value: String, @@ -23,6 +26,7 @@ impl CreateVariableOption { /// CreateVariableOption the option when creating variable pub fn new(value: String) -> CreateVariableOption { CreateVariableOption { + description: None, value, } } diff --git a/crates/gitea-client/src/models/create_wiki_page_options.rs b/crates/gitea-client/src/models/create_wiki_page_options.rs index 520dba1..e57c17d 100644 --- a/crates/gitea-client/src/models/create_wiki_page_options.rs +++ b/crates/gitea-client/src/models/create_wiki_page_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/cron.rs b/crates/gitea-client/src/models/cron.rs index ffd98c2..a14a42e 100644 --- a/crates/gitea-client/src/models/cron.rs +++ b/crates/gitea-client/src/models/cron.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,14 +14,19 @@ use serde::{Deserialize, Serialize}; /// Cron : Cron represents a Cron task #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Cron { + /// The total number of times this cron task has been executed #[serde(rename = "exec_times", skip_serializing_if = "Option::is_none")] pub exec_times: Option, + /// The name of the cron task #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// The next scheduled execution time #[serde(rename = "next", skip_serializing_if = "Option::is_none")] pub next: Option, + /// The previous execution time #[serde(rename = "prev", skip_serializing_if = "Option::is_none")] pub prev: Option, + /// The cron schedule expression (e.g., \"0 0 * * *\") #[serde(rename = "schedule", skip_serializing_if = "Option::is_none")] pub schedule: Option, } diff --git a/crates/gitea-client/src/models/delete_email_option.rs b/crates/gitea-client/src/models/delete_email_option.rs index 9ef9583..a3a3094 100644 --- a/crates/gitea-client/src/models/delete_email_option.rs +++ b/crates/gitea-client/src/models/delete_email_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/delete_file_options.rs b/crates/gitea-client/src/models/delete_file_options.rs index 196e9b5..1416825 100644 --- a/crates/gitea-client/src/models/delete_file_options.rs +++ b/crates/gitea-client/src/models/delete_file_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -29,7 +29,7 @@ pub struct DeleteFileOptions { /// new_branch (optional) will make a new branch from `branch` before creating the file #[serde(rename = "new_branch", skip_serializing_if = "Option::is_none")] pub new_branch: Option, - /// sha is the SHA for the file that already exists + /// the blob ID (SHA) for the file that already exists, it is required for changing existing files #[serde(rename = "sha")] pub sha: String, /// Add a Signed-off-by trailer by the committer at the end of the commit log message. diff --git a/crates/gitea-client/src/models/deploy_key.rs b/crates/gitea-client/src/models/deploy_key.rs index 9657d90..7207eac 100644 --- a/crates/gitea-client/src/models/deploy_key.rs +++ b/crates/gitea-client/src/models/deploy_key.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,20 +16,27 @@ use serde::{Deserialize, Serialize}; pub struct DeployKey { #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, + /// Fingerprint is the key's fingerprint #[serde(rename = "fingerprint", skip_serializing_if = "Option::is_none")] pub fingerprint: Option, + /// ID is the unique identifier for the deploy key #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// Key contains the actual SSH key content #[serde(rename = "key", skip_serializing_if = "Option::is_none")] pub key: Option, + /// KeyID is the associated public key ID #[serde(rename = "key_id", skip_serializing_if = "Option::is_none")] pub key_id: Option, + /// ReadOnly indicates if the key has read-only access #[serde(rename = "read_only", skip_serializing_if = "Option::is_none")] pub read_only: Option, #[serde(rename = "repository", skip_serializing_if = "Option::is_none")] pub repository: Option>, + /// Title is the human-readable name for the key #[serde(rename = "title", skip_serializing_if = "Option::is_none")] pub title: Option, + /// URL is the API URL for this deploy key #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/dismiss_pull_review_options.rs b/crates/gitea-client/src/models/dismiss_pull_review_options.rs index 23d78ec..53f37bd 100644 --- a/crates/gitea-client/src/models/dismiss_pull_review_options.rs +++ b/crates/gitea-client/src/models/dismiss_pull_review_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/edit_attachment_options.rs b/crates/gitea-client/src/models/edit_attachment_options.rs index 7c27f84..f0b05f3 100644 --- a/crates/gitea-client/src/models/edit_attachment_options.rs +++ b/crates/gitea-client/src/models/edit_attachment_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize}; /// EditAttachmentOptions : EditAttachmentOptions options for editing attachments #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EditAttachmentOptions { + /// Name is the new filename for the attachment #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, } diff --git a/crates/gitea-client/src/models/edit_branch_protection_option.rs b/crates/gitea-client/src/models/edit_branch_protection_option.rs index d615c78..7d1c390 100644 --- a/crates/gitea-client/src/models/edit_branch_protection_option.rs +++ b/crates/gitea-client/src/models/edit_branch_protection_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -18,6 +18,8 @@ pub struct EditBranchProtectionOption { pub approvals_whitelist_teams: Option>, #[serde(rename = "approvals_whitelist_username", skip_serializing_if = "Option::is_none")] pub approvals_whitelist_username: Option>, + #[serde(rename = "block_admin_merge_override", skip_serializing_if = "Option::is_none")] + pub block_admin_merge_override: Option, #[serde(rename = "block_on_official_review_requests", skip_serializing_if = "Option::is_none")] pub block_on_official_review_requests: Option, #[serde(rename = "block_on_outdated_branch", skip_serializing_if = "Option::is_none")] @@ -28,6 +30,10 @@ pub struct EditBranchProtectionOption { pub dismiss_stale_approvals: Option, #[serde(rename = "enable_approvals_whitelist", skip_serializing_if = "Option::is_none")] pub enable_approvals_whitelist: Option, + #[serde(rename = "enable_force_push", skip_serializing_if = "Option::is_none")] + pub enable_force_push: Option, + #[serde(rename = "enable_force_push_allowlist", skip_serializing_if = "Option::is_none")] + pub enable_force_push_allowlist: Option, #[serde(rename = "enable_merge_whitelist", skip_serializing_if = "Option::is_none")] pub enable_merge_whitelist: Option, #[serde(rename = "enable_push", skip_serializing_if = "Option::is_none")] @@ -36,12 +42,20 @@ pub struct EditBranchProtectionOption { pub enable_push_whitelist: Option, #[serde(rename = "enable_status_check", skip_serializing_if = "Option::is_none")] pub enable_status_check: Option, + #[serde(rename = "force_push_allowlist_deploy_keys", skip_serializing_if = "Option::is_none")] + pub force_push_allowlist_deploy_keys: Option, + #[serde(rename = "force_push_allowlist_teams", skip_serializing_if = "Option::is_none")] + pub force_push_allowlist_teams: Option>, + #[serde(rename = "force_push_allowlist_usernames", skip_serializing_if = "Option::is_none")] + pub force_push_allowlist_usernames: Option>, #[serde(rename = "ignore_stale_approvals", skip_serializing_if = "Option::is_none")] pub ignore_stale_approvals: Option, #[serde(rename = "merge_whitelist_teams", skip_serializing_if = "Option::is_none")] pub merge_whitelist_teams: Option>, #[serde(rename = "merge_whitelist_usernames", skip_serializing_if = "Option::is_none")] pub merge_whitelist_usernames: Option>, + #[serde(rename = "priority", skip_serializing_if = "Option::is_none")] + pub priority: Option, #[serde(rename = "protected_file_patterns", skip_serializing_if = "Option::is_none")] pub protected_file_patterns: Option, #[serde(rename = "push_whitelist_deploy_keys", skip_serializing_if = "Option::is_none")] @@ -66,18 +80,25 @@ impl EditBranchProtectionOption { EditBranchProtectionOption { approvals_whitelist_teams: None, approvals_whitelist_username: None, + block_admin_merge_override: None, block_on_official_review_requests: None, block_on_outdated_branch: None, block_on_rejected_reviews: None, dismiss_stale_approvals: None, enable_approvals_whitelist: None, + enable_force_push: None, + enable_force_push_allowlist: None, enable_merge_whitelist: None, enable_push: None, enable_push_whitelist: None, enable_status_check: None, + force_push_allowlist_deploy_keys: None, + force_push_allowlist_teams: None, + force_push_allowlist_usernames: None, ignore_stale_approvals: None, merge_whitelist_teams: None, merge_whitelist_usernames: None, + priority: None, protected_file_patterns: None, push_whitelist_deploy_keys: None, push_whitelist_teams: None, diff --git a/crates/gitea-client/src/models/edit_deadline_option.rs b/crates/gitea-client/src/models/edit_deadline_option.rs index b86276a..73cb5ef 100644 --- a/crates/gitea-client/src/models/edit_deadline_option.rs +++ b/crates/gitea-client/src/models/edit_deadline_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/edit_git_hook_option.rs b/crates/gitea-client/src/models/edit_git_hook_option.rs index 739c9f9..0cd3e94 100644 --- a/crates/gitea-client/src/models/edit_git_hook_option.rs +++ b/crates/gitea-client/src/models/edit_git_hook_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize}; /// EditGitHookOption : EditGitHookOption options when modifying one Git hook #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EditGitHookOption { + /// Content is the new script content for the hook #[serde(rename = "content", skip_serializing_if = "Option::is_none")] pub content: Option, } diff --git a/crates/gitea-client/src/models/edit_hook_option.rs b/crates/gitea-client/src/models/edit_hook_option.rs index 6c6a75c..45a53a1 100644 --- a/crates/gitea-client/src/models/edit_hook_option.rs +++ b/crates/gitea-client/src/models/edit_hook_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,14 +14,19 @@ use serde::{Deserialize, Serialize}; /// EditHookOption : EditHookOption options when modify one hook #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EditHookOption { + /// Whether the webhook is active and will be triggered #[serde(rename = "active", skip_serializing_if = "Option::is_none")] pub active: Option, + /// Authorization header to include in webhook requests #[serde(rename = "authorization_header", skip_serializing_if = "Option::is_none")] pub authorization_header: Option, + /// Branch filter pattern to determine which branches trigger the webhook #[serde(rename = "branch_filter", skip_serializing_if = "Option::is_none")] pub branch_filter: Option, + /// Configuration settings for the webhook #[serde(rename = "config", skip_serializing_if = "Option::is_none")] pub config: Option>, + /// List of events that trigger this webhook #[serde(rename = "events", skip_serializing_if = "Option::is_none")] pub events: Option>, } diff --git a/crates/gitea-client/src/models/edit_issue_comment_option.rs b/crates/gitea-client/src/models/edit_issue_comment_option.rs index d4652c2..ded66c3 100644 --- a/crates/gitea-client/src/models/edit_issue_comment_option.rs +++ b/crates/gitea-client/src/models/edit_issue_comment_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/edit_issue_option.rs b/crates/gitea-client/src/models/edit_issue_option.rs index 301d7cf..53f3d57 100644 --- a/crates/gitea-client/src/models/edit_issue_option.rs +++ b/crates/gitea-client/src/models/edit_issue_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/edit_label_option.rs b/crates/gitea-client/src/models/edit_label_option.rs index 355181b..6796777 100644 --- a/crates/gitea-client/src/models/edit_label_option.rs +++ b/crates/gitea-client/src/models/edit_label_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,12 +16,14 @@ use serde::{Deserialize, Serialize}; pub struct EditLabelOption { #[serde(rename = "color", skip_serializing_if = "Option::is_none")] pub color: Option, + /// Description provides additional context about the label's purpose #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(rename = "exclusive", skip_serializing_if = "Option::is_none")] pub exclusive: Option, #[serde(rename = "is_archived", skip_serializing_if = "Option::is_none")] pub is_archived: Option, + /// Name is the new display name for the label #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, } diff --git a/crates/gitea-client/src/models/edit_milestone_option.rs b/crates/gitea-client/src/models/edit_milestone_option.rs index 15347ef..cca8d87 100644 --- a/crates/gitea-client/src/models/edit_milestone_option.rs +++ b/crates/gitea-client/src/models/edit_milestone_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,12 +14,16 @@ use serde::{Deserialize, Serialize}; /// EditMilestoneOption : EditMilestoneOption options for editing a milestone #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EditMilestoneOption { + /// Description provides updated details about the milestone #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, + /// Deadline is the updated due date for the milestone #[serde(rename = "due_on", skip_serializing_if = "Option::is_none")] pub due_on: Option, + /// State indicates the updated state of the milestone #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option, + /// Title is the updated title of the milestone #[serde(rename = "title", skip_serializing_if = "Option::is_none")] pub title: Option, } diff --git a/crates/gitea-client/src/models/edit_org_option.rs b/crates/gitea-client/src/models/edit_org_option.rs index d473a96..a5b69f7 100644 --- a/crates/gitea-client/src/models/edit_org_option.rs +++ b/crates/gitea-client/src/models/edit_org_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,19 +14,25 @@ use serde::{Deserialize, Serialize}; /// EditOrgOption : EditOrgOption options for editing an organization #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EditOrgOption { + /// The description of the organization #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, + /// The email address of the organization #[serde(rename = "email", skip_serializing_if = "Option::is_none")] pub email: Option, + /// The full display name of the organization #[serde(rename = "full_name", skip_serializing_if = "Option::is_none")] pub full_name: Option, + /// The location of the organization #[serde(rename = "location", skip_serializing_if = "Option::is_none")] pub location: Option, + /// Whether repository administrators can change team access #[serde(rename = "repo_admin_change_team_access", skip_serializing_if = "Option::is_none")] pub repo_admin_change_team_access: Option, /// possible values are `public`, `limited` or `private` #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, + /// The website URL of the organization #[serde(rename = "website", skip_serializing_if = "Option::is_none")] pub website: Option, } diff --git a/crates/gitea-client/src/models/edit_pull_request_option.rs b/crates/gitea-client/src/models/edit_pull_request_option.rs index 7d27e48..7cdeeaf 100644 --- a/crates/gitea-client/src/models/edit_pull_request_option.rs +++ b/crates/gitea-client/src/models/edit_pull_request_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,26 +14,36 @@ use serde::{Deserialize, Serialize}; /// EditPullRequestOption : EditPullRequestOption options when modify pull request #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EditPullRequestOption { + /// Whether to allow maintainer edits #[serde(rename = "allow_maintainer_edit", skip_serializing_if = "Option::is_none")] pub allow_maintainer_edit: Option, + /// The new primary assignee username #[serde(rename = "assignee", skip_serializing_if = "Option::is_none")] pub assignee: Option, + /// The new list of assignee usernames #[serde(rename = "assignees", skip_serializing_if = "Option::is_none")] pub assignees: Option>, + /// The new base branch for the pull request #[serde(rename = "base", skip_serializing_if = "Option::is_none")] pub base: Option, + /// The new description body for the pull request #[serde(rename = "body", skip_serializing_if = "Option::is_none")] pub body: Option, #[serde(rename = "due_date", skip_serializing_if = "Option::is_none")] pub due_date: Option, + /// The new list of label IDs for the pull request #[serde(rename = "labels", skip_serializing_if = "Option::is_none")] pub labels: Option>, + /// The new milestone ID for the pull request #[serde(rename = "milestone", skip_serializing_if = "Option::is_none")] pub milestone: Option, + /// The new state for the pull request #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option, + /// The new title for the pull request #[serde(rename = "title", skip_serializing_if = "Option::is_none")] pub title: Option, + /// Whether to remove the current deadline #[serde(rename = "unset_due_date", skip_serializing_if = "Option::is_none")] pub unset_due_date: Option, } diff --git a/crates/gitea-client/src/models/edit_reaction_option.rs b/crates/gitea-client/src/models/edit_reaction_option.rs index 687dabe..fe1499e 100644 --- a/crates/gitea-client/src/models/edit_reaction_option.rs +++ b/crates/gitea-client/src/models/edit_reaction_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize}; /// EditReactionOption : EditReactionOption contain the reaction type #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EditReactionOption { + /// The reaction content (e.g., emoji or reaction type) #[serde(rename = "content", skip_serializing_if = "Option::is_none")] pub content: Option, } diff --git a/crates/gitea-client/src/models/edit_release_option.rs b/crates/gitea-client/src/models/edit_release_option.rs index 7f39db4..7110d53 100644 --- a/crates/gitea-client/src/models/edit_release_option.rs +++ b/crates/gitea-client/src/models/edit_release_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,16 +14,22 @@ use serde::{Deserialize, Serialize}; /// EditReleaseOption : EditReleaseOption options when editing a release #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EditReleaseOption { + /// The new release notes or description #[serde(rename = "body", skip_serializing_if = "Option::is_none")] pub body: Option, + /// Whether to change the draft status #[serde(rename = "draft", skip_serializing_if = "Option::is_none")] pub draft: Option, + /// The new display title of the release #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// Whether to change the prerelease status #[serde(rename = "prerelease", skip_serializing_if = "Option::is_none")] pub prerelease: Option, + /// The new name of the git tag #[serde(rename = "tag_name", skip_serializing_if = "Option::is_none")] pub tag_name: Option, + /// The new target commitish for the release #[serde(rename = "target_commitish", skip_serializing_if = "Option::is_none")] pub target_commitish: Option, } diff --git a/crates/gitea-client/src/models/edit_repo_option.rs b/crates/gitea-client/src/models/edit_repo_option.rs index e543156..f44fb96 100644 --- a/crates/gitea-client/src/models/edit_repo_option.rs +++ b/crates/gitea-client/src/models/edit_repo_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -66,6 +66,9 @@ pub struct EditRepoOption { /// either `true` to enable actions unit, or `false` to disable them. #[serde(rename = "has_actions", skip_serializing_if = "Option::is_none")] pub has_actions: Option, + /// either `true` to enable code for this repository or `false` to disable it. + #[serde(rename = "has_code", skip_serializing_if = "Option::is_none")] + pub has_code: Option, /// either `true` to enable issues for this repository or `false` to disable them. #[serde(rename = "has_issues", skip_serializing_if = "Option::is_none")] pub has_issues: Option, @@ -131,6 +134,7 @@ impl EditRepoOption { external_tracker: None, external_wiki: None, has_actions: None, + has_code: None, has_issues: None, has_packages: None, has_projects: None, diff --git a/crates/gitea-client/src/models/edit_tag_protection_option.rs b/crates/gitea-client/src/models/edit_tag_protection_option.rs new file mode 100644 index 0000000..97950ee --- /dev/null +++ b/crates/gitea-client/src/models/edit_tag_protection_option.rs @@ -0,0 +1,38 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// EditTagProtectionOption : EditTagProtectionOption options for editing a tag protection +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct EditTagProtectionOption { + /// The pattern to match tag names for protection + #[serde(rename = "name_pattern", skip_serializing_if = "Option::is_none")] + pub name_pattern: Option, + /// List of team names allowed to create/delete protected tags + #[serde(rename = "whitelist_teams", skip_serializing_if = "Option::is_none")] + pub whitelist_teams: Option>, + /// List of usernames allowed to create/delete protected tags + #[serde(rename = "whitelist_usernames", skip_serializing_if = "Option::is_none")] + pub whitelist_usernames: Option>, +} + +impl EditTagProtectionOption { + /// EditTagProtectionOption options for editing a tag protection + pub fn new() -> EditTagProtectionOption { + EditTagProtectionOption { + name_pattern: None, + whitelist_teams: None, + whitelist_usernames: None, + } + } +} + diff --git a/crates/gitea-client/src/models/edit_team_option.rs b/crates/gitea-client/src/models/edit_team_option.rs index f162095..73191f7 100644 --- a/crates/gitea-client/src/models/edit_team_option.rs +++ b/crates/gitea-client/src/models/edit_team_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,10 +14,13 @@ use serde::{Deserialize, Serialize}; /// EditTeamOption : EditTeamOption options for editing a team #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EditTeamOption { + /// Whether the team can create repositories in the organization #[serde(rename = "can_create_org_repo", skip_serializing_if = "Option::is_none")] pub can_create_org_repo: Option, + /// The description of the team #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, + /// Whether the team has access to all repositories in the organization #[serde(rename = "includes_all_repositories", skip_serializing_if = "Option::is_none")] pub includes_all_repositories: Option, #[serde(rename = "name")] diff --git a/crates/gitea-client/src/models/edit_user_option.rs b/crates/gitea-client/src/models/edit_user_option.rs index 85f5f37..543bbd1 100644 --- a/crates/gitea-client/src/models/edit_user_option.rs +++ b/crates/gitea-client/src/models/edit_user_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,40 +14,56 @@ use serde::{Deserialize, Serialize}; /// EditUserOption : EditUserOption edit user options #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EditUserOption { + /// Whether the user account is active #[serde(rename = "active", skip_serializing_if = "Option::is_none")] pub active: Option, + /// Whether the user has administrator privileges #[serde(rename = "admin", skip_serializing_if = "Option::is_none")] pub admin: Option, + /// Whether the user can create organizations #[serde(rename = "allow_create_organization", skip_serializing_if = "Option::is_none")] pub allow_create_organization: Option, + /// Whether the user can use Git hooks #[serde(rename = "allow_git_hook", skip_serializing_if = "Option::is_none")] pub allow_git_hook: Option, + /// Whether the user can import local repositories #[serde(rename = "allow_import_local", skip_serializing_if = "Option::is_none")] pub allow_import_local: Option, + /// The user's personal description or bio #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(rename = "email", skip_serializing_if = "Option::is_none")] pub email: Option, + /// The full display name of the user #[serde(rename = "full_name", skip_serializing_if = "Option::is_none")] pub full_name: Option, + /// The user's location or address #[serde(rename = "location", skip_serializing_if = "Option::is_none")] pub location: Option, + /// identifier of the user, provided by the external authenticator (if configured) #[serde(rename = "login_name")] pub login_name: String, + /// Maximum number of repositories the user can create #[serde(rename = "max_repo_creation", skip_serializing_if = "Option::is_none")] pub max_repo_creation: Option, + /// Whether the user must change password on next login #[serde(rename = "must_change_password", skip_serializing_if = "Option::is_none")] pub must_change_password: Option, + /// The plain text password for the user #[serde(rename = "password", skip_serializing_if = "Option::is_none")] pub password: Option, + /// Whether the user is prohibited from logging in #[serde(rename = "prohibit_login", skip_serializing_if = "Option::is_none")] pub prohibit_login: Option, + /// Whether the user has restricted access privileges #[serde(rename = "restricted", skip_serializing_if = "Option::is_none")] pub restricted: Option, #[serde(rename = "source_id")] pub source_id: i64, + /// User visibility level: public, limited, or private #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, + /// The user's personal website URL #[serde(rename = "website", skip_serializing_if = "Option::is_none")] pub website: Option, } diff --git a/crates/gitea-client/src/models/email.rs b/crates/gitea-client/src/models/email.rs index 2ee392b..026ef13 100644 --- a/crates/gitea-client/src/models/email.rs +++ b/crates/gitea-client/src/models/email.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,12 +16,16 @@ use serde::{Deserialize, Serialize}; pub struct Email { #[serde(rename = "email", skip_serializing_if = "Option::is_none")] pub email: Option, + /// Whether this is the primary email address #[serde(rename = "primary", skip_serializing_if = "Option::is_none")] pub primary: Option, + /// The unique identifier of the user who owns this email #[serde(rename = "user_id", skip_serializing_if = "Option::is_none")] pub user_id: Option, + /// username of the user #[serde(rename = "username", skip_serializing_if = "Option::is_none")] pub username: Option, + /// Whether the email address has been verified #[serde(rename = "verified", skip_serializing_if = "Option::is_none")] pub verified: Option, } diff --git a/crates/gitea-client/src/models/external_tracker.rs b/crates/gitea-client/src/models/external_tracker.rs index 73b5ba0..2aa7d10 100644 --- a/crates/gitea-client/src/models/external_tracker.rs +++ b/crates/gitea-client/src/models/external_tracker.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/external_wiki.rs b/crates/gitea-client/src/models/external_wiki.rs index f07f94b..0028b98 100644 --- a/crates/gitea-client/src/models/external_wiki.rs +++ b/crates/gitea-client/src/models/external_wiki.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/file_commit_response.rs b/crates/gitea-client/src/models/file_commit_response.rs index b493dbf..3e4b134 100644 --- a/crates/gitea-client/src/models/file_commit_response.rs +++ b/crates/gitea-client/src/models/file_commit_response.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -19,16 +19,21 @@ pub struct FileCommitResponse { pub committer: Option>, #[serde(rename = "created", skip_serializing_if = "Option::is_none")] pub created: Option, + /// HTMLURL is the web URL for viewing this commit #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] pub html_url: Option, + /// Message is the commit message #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, + /// Parents contains parent commit metadata #[serde(rename = "parents", skip_serializing_if = "Option::is_none")] pub parents: Option>, + /// SHA is the commit SHA hash #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, #[serde(rename = "tree", skip_serializing_if = "Option::is_none")] pub tree: Option>, + /// URL is the API URL for the commit #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/file_delete_response.rs b/crates/gitea-client/src/models/file_delete_response.rs index b9b9caa..8adff7d 100644 --- a/crates/gitea-client/src/models/file_delete_response.rs +++ b/crates/gitea-client/src/models/file_delete_response.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,6 +16,7 @@ use serde::{Deserialize, Serialize}; pub struct FileDeleteResponse { #[serde(rename = "commit", skip_serializing_if = "Option::is_none")] pub commit: Option>, + /// Content is always null for delete operations #[serde(rename = "content", skip_serializing_if = "Option::is_none")] pub content: Option, #[serde(rename = "verification", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/file_links_response.rs b/crates/gitea-client/src/models/file_links_response.rs index aa2012a..e73b577 100644 --- a/crates/gitea-client/src/models/file_links_response.rs +++ b/crates/gitea-client/src/models/file_links_response.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,10 +14,13 @@ use serde::{Deserialize, Serialize}; /// FileLinksResponse : FileLinksResponse contains the links for a repo's file #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FileLinksResponse { + /// GitURL is the Git API URL for this file #[serde(rename = "git", skip_serializing_if = "Option::is_none")] pub git: Option, + /// HTMLURL is the web URL for this file #[serde(rename = "html", skip_serializing_if = "Option::is_none")] pub html: Option, + /// Self is the API URL for this file #[serde(rename = "self", skip_serializing_if = "Option::is_none")] pub param_self: Option, } diff --git a/crates/gitea-client/src/models/file_response.rs b/crates/gitea-client/src/models/file_response.rs index df9cf3e..194b668 100644 --- a/crates/gitea-client/src/models/file_response.rs +++ b/crates/gitea-client/src/models/file_response.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/files_response.rs b/crates/gitea-client/src/models/files_response.rs index 77b8d51..d793488 100644 --- a/crates/gitea-client/src/models/files_response.rs +++ b/crates/gitea-client/src/models/files_response.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,6 +16,7 @@ use serde::{Deserialize, Serialize}; pub struct FilesResponse { #[serde(rename = "commit", skip_serializing_if = "Option::is_none")] pub commit: Option>, + /// Files contains the list of file contents and metadata #[serde(rename = "files", skip_serializing_if = "Option::is_none")] pub files: Option>, #[serde(rename = "verification", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/general_api_settings.rs b/crates/gitea-client/src/models/general_api_settings.rs index 2311394..8477408 100644 --- a/crates/gitea-client/src/models/general_api_settings.rs +++ b/crates/gitea-client/src/models/general_api_settings.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,12 +14,19 @@ use serde::{Deserialize, Serialize}; /// GeneralApiSettings : GeneralAPISettings contains global api settings exposed by it #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GeneralApiSettings { + /// DefaultGitTreesPerPage is the default number of Git tree items per page #[serde(rename = "default_git_trees_per_page", skip_serializing_if = "Option::is_none")] pub default_git_trees_per_page: Option, + /// DefaultMaxBlobSize is the default maximum blob size for API responses #[serde(rename = "default_max_blob_size", skip_serializing_if = "Option::is_none")] pub default_max_blob_size: Option, + /// DefaultMaxResponseSize is the default maximum response size + #[serde(rename = "default_max_response_size", skip_serializing_if = "Option::is_none")] + pub default_max_response_size: Option, + /// DefaultPagingNum is the default number of items per page #[serde(rename = "default_paging_num", skip_serializing_if = "Option::is_none")] pub default_paging_num: Option, + /// MaxResponseItems is the maximum number of items returned in API responses #[serde(rename = "max_response_items", skip_serializing_if = "Option::is_none")] pub max_response_items: Option, } @@ -30,6 +37,7 @@ impl GeneralApiSettings { GeneralApiSettings { default_git_trees_per_page: None, default_max_blob_size: None, + default_max_response_size: None, default_paging_num: None, max_response_items: None, } diff --git a/crates/gitea-client/src/models/general_attachment_settings.rs b/crates/gitea-client/src/models/general_attachment_settings.rs index c6a6df5..9ffd6e1 100644 --- a/crates/gitea-client/src/models/general_attachment_settings.rs +++ b/crates/gitea-client/src/models/general_attachment_settings.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,12 +14,16 @@ use serde::{Deserialize, Serialize}; /// GeneralAttachmentSettings : GeneralAttachmentSettings contains global Attachment settings exposed by API #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GeneralAttachmentSettings { + /// AllowedTypes contains the allowed file types for attachments #[serde(rename = "allowed_types", skip_serializing_if = "Option::is_none")] pub allowed_types: Option, + /// Enabled indicates if file attachments are enabled #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] pub enabled: Option, + /// MaxFiles is the maximum number of files per attachment #[serde(rename = "max_files", skip_serializing_if = "Option::is_none")] pub max_files: Option, + /// MaxSize is the maximum size for individual attachments #[serde(rename = "max_size", skip_serializing_if = "Option::is_none")] pub max_size: Option, } diff --git a/crates/gitea-client/src/models/general_repo_settings.rs b/crates/gitea-client/src/models/general_repo_settings.rs index 43ddb24..7522e14 100644 --- a/crates/gitea-client/src/models/general_repo_settings.rs +++ b/crates/gitea-client/src/models/general_repo_settings.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,16 +14,22 @@ use serde::{Deserialize, Serialize}; /// GeneralRepoSettings : GeneralRepoSettings contains global repository settings exposed by API #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GeneralRepoSettings { + /// HTTPGitDisabled indicates if HTTP Git operations are disabled #[serde(rename = "http_git_disabled", skip_serializing_if = "Option::is_none")] pub http_git_disabled: Option, + /// LFSDisabled indicates if Git LFS support is disabled #[serde(rename = "lfs_disabled", skip_serializing_if = "Option::is_none")] pub lfs_disabled: Option, + /// MigrationsDisabled indicates if repository migrations are disabled #[serde(rename = "migrations_disabled", skip_serializing_if = "Option::is_none")] pub migrations_disabled: Option, + /// MirrorsDisabled indicates if repository mirroring is disabled #[serde(rename = "mirrors_disabled", skip_serializing_if = "Option::is_none")] pub mirrors_disabled: Option, + /// StarsDisabled indicates if repository starring is disabled #[serde(rename = "stars_disabled", skip_serializing_if = "Option::is_none")] pub stars_disabled: Option, + /// TimeTrackingDisabled indicates if time tracking is disabled #[serde(rename = "time_tracking_disabled", skip_serializing_if = "Option::is_none")] pub time_tracking_disabled: Option, } diff --git a/crates/gitea-client/src/models/general_ui_settings.rs b/crates/gitea-client/src/models/general_ui_settings.rs index 9f611c3..1c4108f 100644 --- a/crates/gitea-client/src/models/general_ui_settings.rs +++ b/crates/gitea-client/src/models/general_ui_settings.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,10 +14,13 @@ use serde::{Deserialize, Serialize}; /// GeneralUiSettings : GeneralUISettings contains global ui settings exposed by API #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GeneralUiSettings { + /// AllowedReactions contains the list of allowed emoji reactions #[serde(rename = "allowed_reactions", skip_serializing_if = "Option::is_none")] pub allowed_reactions: Option>, + /// CustomEmojis contains the list of custom emojis #[serde(rename = "custom_emojis", skip_serializing_if = "Option::is_none")] pub custom_emojis: Option>, + /// DefaultTheme is the default UI theme #[serde(rename = "default_theme", skip_serializing_if = "Option::is_none")] pub default_theme: Option, } diff --git a/crates/gitea-client/src/models/generate_repo_option.rs b/crates/gitea-client/src/models/generate_repo_option.rs index 1ecfd99..be79833 100644 --- a/crates/gitea-client/src/models/generate_repo_option.rs +++ b/crates/gitea-client/src/models/generate_repo_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -11,7 +11,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// GenerateRepoOption : GenerateRepoOption options when creating repository using a template +/// GenerateRepoOption : GenerateRepoOption options when creating a repository using a template #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GenerateRepoOption { /// include avatar of the template repo @@ -32,10 +32,9 @@ pub struct GenerateRepoOption { /// include labels in template repo #[serde(rename = "labels", skip_serializing_if = "Option::is_none")] pub labels: Option, - /// Name of the repository to create #[serde(rename = "name")] pub name: String, - /// The organization or person who will own the new repository + /// the organization's name or individual user's name who will own the new repository #[serde(rename = "owner")] pub owner: String, /// Whether the repository is private @@ -53,7 +52,7 @@ pub struct GenerateRepoOption { } impl GenerateRepoOption { - /// GenerateRepoOption options when creating repository using a template + /// GenerateRepoOption options when creating a repository using a template pub fn new(name: String, owner: String) -> GenerateRepoOption { GenerateRepoOption { avatar: None, diff --git a/crates/gitea-client/src/models/get_files_options.rs b/crates/gitea-client/src/models/get_files_options.rs new file mode 100644 index 0000000..5a7afe3 --- /dev/null +++ b/crates/gitea-client/src/models/get_files_options.rs @@ -0,0 +1,30 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// GetFilesOptions : GetFilesOptions options for retrieving metadate and content of multiple files +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetFilesOptions { + /// Files is the list of file paths to retrieve + #[serde(rename = "files", skip_serializing_if = "Option::is_none")] + pub files: Option>, +} + +impl GetFilesOptions { + /// GetFilesOptions options for retrieving metadate and content of multiple files + pub fn new() -> GetFilesOptions { + GetFilesOptions { + files: None, + } + } +} + diff --git a/crates/gitea-client/src/models/git_blob_response.rs b/crates/gitea-client/src/models/git_blob_response.rs index 0f4d7e0..42e62d6 100644 --- a/crates/gitea-client/src/models/git_blob_response.rs +++ b/crates/gitea-client/src/models/git_blob_response.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,14 +14,25 @@ use serde::{Deserialize, Serialize}; /// GitBlobResponse : GitBlobResponse represents a git blob #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GitBlobResponse { + /// The content of the git blob (may be base64 encoded) #[serde(rename = "content", skip_serializing_if = "Option::is_none")] pub content: Option, + /// The encoding used for the content (e.g., \"base64\") #[serde(rename = "encoding", skip_serializing_if = "Option::is_none")] pub encoding: Option, + /// The LFS object ID if this blob is stored in LFS + #[serde(rename = "lfs_oid", skip_serializing_if = "Option::is_none")] + pub lfs_oid: Option, + /// The size of the LFS object if this blob is stored in LFS + #[serde(rename = "lfs_size", skip_serializing_if = "Option::is_none")] + pub lfs_size: Option, + /// The SHA hash of the git blob #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, + /// The size of the git blob in bytes #[serde(rename = "size", skip_serializing_if = "Option::is_none")] pub size: Option, + /// The URL to access this git blob #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } @@ -32,6 +43,8 @@ impl GitBlobResponse { GitBlobResponse { content: None, encoding: None, + lfs_oid: None, + lfs_size: None, sha: None, size: None, url: None, diff --git a/crates/gitea-client/src/models/git_entry.rs b/crates/gitea-client/src/models/git_entry.rs index fcd5b88..b9a1672 100644 --- a/crates/gitea-client/src/models/git_entry.rs +++ b/crates/gitea-client/src/models/git_entry.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,16 +14,22 @@ use serde::{Deserialize, Serialize}; /// GitEntry : GitEntry represents a git tree #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GitEntry { + /// Mode is the file mode (permissions) #[serde(rename = "mode", skip_serializing_if = "Option::is_none")] pub mode: Option, + /// Path is the file or directory path #[serde(rename = "path", skip_serializing_if = "Option::is_none")] pub path: Option, + /// SHA is the Git object SHA #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, + /// Size is the file size in bytes #[serde(rename = "size", skip_serializing_if = "Option::is_none")] pub size: Option, + /// Type indicates if this is a file, directory, or symlink #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub r#type: Option, + /// URL is the API URL for this tree entry #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/git_hook.rs b/crates/gitea-client/src/models/git_hook.rs index dd58f3c..7eade60 100644 --- a/crates/gitea-client/src/models/git_hook.rs +++ b/crates/gitea-client/src/models/git_hook.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,10 +14,13 @@ use serde::{Deserialize, Serialize}; /// GitHook : GitHook represents a Git repository hook #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GitHook { + /// Content contains the script content of the hook #[serde(rename = "content", skip_serializing_if = "Option::is_none")] pub content: Option, + /// IsActive indicates if the hook is active #[serde(rename = "is_active", skip_serializing_if = "Option::is_none")] pub is_active: Option, + /// Name is the name of the Git hook #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, } diff --git a/crates/gitea-client/src/models/git_object.rs b/crates/gitea-client/src/models/git_object.rs index a2cda5c..80cf31d 100644 --- a/crates/gitea-client/src/models/git_object.rs +++ b/crates/gitea-client/src/models/git_object.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -13,10 +13,13 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GitObject { + /// The SHA hash of the Git object #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, + /// The type of the Git object (e.g., commit, tag, tree, blob) #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub r#type: Option, + /// The URL to access this Git object #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/git_tree_response.rs b/crates/gitea-client/src/models/git_tree_response.rs index 0dbc295..7e86a32 100644 --- a/crates/gitea-client/src/models/git_tree_response.rs +++ b/crates/gitea-client/src/models/git_tree_response.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,16 +14,22 @@ use serde::{Deserialize, Serialize}; /// GitTreeResponse : GitTreeResponse returns a git tree #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GitTreeResponse { + /// Page is the current page number for pagination #[serde(rename = "page", skip_serializing_if = "Option::is_none")] pub page: Option, + /// SHA is the tree object SHA #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, + /// TotalCount is the total number of entries in the tree #[serde(rename = "total_count", skip_serializing_if = "Option::is_none")] pub total_count: Option, + /// Entries contains the tree entries (files and directories) #[serde(rename = "tree", skip_serializing_if = "Option::is_none")] pub tree: Option>, + /// Truncated indicates if the response was truncated due to size #[serde(rename = "truncated", skip_serializing_if = "Option::is_none")] pub truncated: Option, + /// URL is the API URL for this tree #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/gitignore_template_info.rs b/crates/gitea-client/src/models/gitignore_template_info.rs index d5b4904..a88b180 100644 --- a/crates/gitea-client/src/models/gitignore_template_info.rs +++ b/crates/gitea-client/src/models/gitignore_template_info.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,8 +14,10 @@ use serde::{Deserialize, Serialize}; /// GitignoreTemplateInfo : GitignoreTemplateInfo name and text of a gitignore template #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GitignoreTemplateInfo { + /// Name is the name of the gitignore template #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// Source contains the content of the gitignore template #[serde(rename = "source", skip_serializing_if = "Option::is_none")] pub source: Option, } diff --git a/crates/gitea-client/src/models/gpg_key.rs b/crates/gitea-client/src/models/gpg_key.rs index ee0f58e..46274d0 100644 --- a/crates/gitea-client/src/models/gpg_key.rs +++ b/crates/gitea-client/src/models/gpg_key.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,30 +14,41 @@ use serde::{Deserialize, Serialize}; /// GpgKey : GPGKey a user GPG key to sign commit and tag in repository #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GpgKey { + /// Whether the key can be used for certification #[serde(rename = "can_certify", skip_serializing_if = "Option::is_none")] pub can_certify: Option, + /// Whether the key can be used for encrypting communications #[serde(rename = "can_encrypt_comms", skip_serializing_if = "Option::is_none")] pub can_encrypt_comms: Option, + /// Whether the key can be used for encrypting storage #[serde(rename = "can_encrypt_storage", skip_serializing_if = "Option::is_none")] pub can_encrypt_storage: Option, + /// Whether the key can be used for signing #[serde(rename = "can_sign", skip_serializing_if = "Option::is_none")] pub can_sign: Option, #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, + /// List of email addresses associated with this GPG key #[serde(rename = "emails", skip_serializing_if = "Option::is_none")] pub emails: Option>, #[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")] pub expires_at: Option, + /// The unique identifier of the GPG key #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// The key ID of the GPG key #[serde(rename = "key_id", skip_serializing_if = "Option::is_none")] pub key_id: Option, + /// The primary key ID of the GPG key #[serde(rename = "primary_key_id", skip_serializing_if = "Option::is_none")] pub primary_key_id: Option, + /// The public key content in armored format #[serde(rename = "public_key", skip_serializing_if = "Option::is_none")] pub public_key: Option, + /// List of subkeys of this GPG key #[serde(rename = "subkeys", skip_serializing_if = "Option::is_none")] pub subkeys: Option>, + /// Whether the GPG key has been verified #[serde(rename = "verified", skip_serializing_if = "Option::is_none")] pub verified: Option, } diff --git a/crates/gitea-client/src/models/gpg_key_email.rs b/crates/gitea-client/src/models/gpg_key_email.rs index e1f2f49..be49c4b 100644 --- a/crates/gitea-client/src/models/gpg_key_email.rs +++ b/crates/gitea-client/src/models/gpg_key_email.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,8 +14,10 @@ use serde::{Deserialize, Serialize}; /// GpgKeyEmail : GPGKeyEmail an email attached to a GPGKey #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GpgKeyEmail { + /// The email address associated with the GPG key #[serde(rename = "email", skip_serializing_if = "Option::is_none")] pub email: Option, + /// Whether the email address has been verified #[serde(rename = "verified", skip_serializing_if = "Option::is_none")] pub verified: Option, } diff --git a/crates/gitea-client/src/models/hook.rs b/crates/gitea-client/src/models/hook.rs index 003d37b..9e7de16 100644 --- a/crates/gitea-client/src/models/hook.rs +++ b/crates/gitea-client/src/models/hook.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,20 +14,27 @@ use serde::{Deserialize, Serialize}; /// Hook : Hook a hook is a web hook when one repository changed #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Hook { + /// Whether the webhook is active and will be triggered #[serde(rename = "active", skip_serializing_if = "Option::is_none")] pub active: Option, + /// Authorization header to include in webhook requests #[serde(rename = "authorization_header", skip_serializing_if = "Option::is_none")] pub authorization_header: Option, + /// Branch filter pattern to determine which branches trigger the webhook #[serde(rename = "branch_filter", skip_serializing_if = "Option::is_none")] pub branch_filter: Option, + /// Configuration settings for the webhook #[serde(rename = "config", skip_serializing_if = "Option::is_none")] pub config: Option>, #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, + /// List of events that trigger this webhook #[serde(rename = "events", skip_serializing_if = "Option::is_none")] pub events: Option>, + /// The unique identifier of the webhook #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// The type of the webhook (e.g., gitea, slack, discord) #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub r#type: Option, #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/identity.rs b/crates/gitea-client/src/models/identity.rs index 80d12c1..31aa550 100644 --- a/crates/gitea-client/src/models/identity.rs +++ b/crates/gitea-client/src/models/identity.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,6 +16,7 @@ use serde::{Deserialize, Serialize}; pub struct Identity { #[serde(rename = "email", skip_serializing_if = "Option::is_none")] pub email: Option, + /// Name is the person's name #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, } diff --git a/crates/gitea-client/src/models/internal_tracker.rs b/crates/gitea-client/src/models/internal_tracker.rs index 6bb4ca0..644e586 100644 --- a/crates/gitea-client/src/models/internal_tracker.rs +++ b/crates/gitea-client/src/models/internal_tracker.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/issue.rs b/crates/gitea-client/src/models/issue.rs index ee1e49c..553f628 100644 --- a/crates/gitea-client/src/models/issue.rs +++ b/crates/gitea-client/src/models/issue.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -57,6 +57,8 @@ pub struct Issue { /// StateType issue state type #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option, + #[serde(rename = "time_estimate", skip_serializing_if = "Option::is_none")] + pub time_estimate: Option, #[serde(rename = "title", skip_serializing_if = "Option::is_none")] pub title: Option, #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] @@ -92,6 +94,7 @@ impl Issue { r#ref: None, repository: None, state: None, + time_estimate: None, title: None, updated_at: None, url: None, diff --git a/crates/gitea-client/src/models/issue_config.rs b/crates/gitea-client/src/models/issue_config.rs index e2f1a4b..125f4d6 100644 --- a/crates/gitea-client/src/models/issue_config.rs +++ b/crates/gitea-client/src/models/issue_config.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/issue_config_contact_link.rs b/crates/gitea-client/src/models/issue_config_contact_link.rs index 2bf812b..75d25cb 100644 --- a/crates/gitea-client/src/models/issue_config_contact_link.rs +++ b/crates/gitea-client/src/models/issue_config_contact_link.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/issue_config_validation.rs b/crates/gitea-client/src/models/issue_config_validation.rs index e2ef638..e20fc7a 100644 --- a/crates/gitea-client/src/models/issue_config_validation.rs +++ b/crates/gitea-client/src/models/issue_config_validation.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/issue_deadline.rs b/crates/gitea-client/src/models/issue_deadline.rs index f11979b..9194e21 100644 --- a/crates/gitea-client/src/models/issue_deadline.rs +++ b/crates/gitea-client/src/models/issue_deadline.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/issue_form_field.rs b/crates/gitea-client/src/models/issue_form_field.rs index d08194f..c5f19ee 100644 --- a/crates/gitea-client/src/models/issue_form_field.rs +++ b/crates/gitea-client/src/models/issue_form_field.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/issue_labels_option.rs b/crates/gitea-client/src/models/issue_labels_option.rs index 5177a08..0c36e9e 100644 --- a/crates/gitea-client/src/models/issue_labels_option.rs +++ b/crates/gitea-client/src/models/issue_labels_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/issue_meta.rs b/crates/gitea-client/src/models/issue_meta.rs index 438b64e..e29de21 100644 --- a/crates/gitea-client/src/models/issue_meta.rs +++ b/crates/gitea-client/src/models/issue_meta.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,6 +16,7 @@ use serde::{Deserialize, Serialize}; pub struct IssueMeta { #[serde(rename = "index", skip_serializing_if = "Option::is_none")] pub index: Option, + /// owner of the issue's repo #[serde(rename = "owner", skip_serializing_if = "Option::is_none")] pub owner: Option, #[serde(rename = "repo", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/issue_template.rs b/crates/gitea-client/src/models/issue_template.rs index ae793c8..681643c 100644 --- a/crates/gitea-client/src/models/issue_template.rs +++ b/crates/gitea-client/src/models/issue_template.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,6 +16,8 @@ use serde::{Deserialize, Serialize}; pub struct IssueTemplate { #[serde(rename = "about", skip_serializing_if = "Option::is_none")] pub about: Option, + #[serde(rename = "assignees", skip_serializing_if = "Option::is_none")] + pub assignees: Option>, #[serde(rename = "body", skip_serializing_if = "Option::is_none")] pub body: Option>, #[serde(rename = "content", skip_serializing_if = "Option::is_none")] @@ -37,6 +39,7 @@ impl IssueTemplate { pub fn new() -> IssueTemplate { IssueTemplate { about: None, + assignees: None, body: None, content: None, file_name: None, diff --git a/crates/gitea-client/src/models/label.rs b/crates/gitea-client/src/models/label.rs index 3865605..aa79ee2 100644 --- a/crates/gitea-client/src/models/label.rs +++ b/crates/gitea-client/src/models/label.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,16 +16,20 @@ use serde::{Deserialize, Serialize}; pub struct Label { #[serde(rename = "color", skip_serializing_if = "Option::is_none")] pub color: Option, + /// Description provides additional context about the label's purpose #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(rename = "exclusive", skip_serializing_if = "Option::is_none")] pub exclusive: Option, + /// ID is the unique identifier for the label #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, #[serde(rename = "is_archived", skip_serializing_if = "Option::is_none")] pub is_archived: Option, + /// Name is the display name of the label #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// URL is the API endpoint for accessing this label #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/label_template.rs b/crates/gitea-client/src/models/label_template.rs index 23c826b..1b1776b 100644 --- a/crates/gitea-client/src/models/label_template.rs +++ b/crates/gitea-client/src/models/label_template.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,10 +16,12 @@ use serde::{Deserialize, Serialize}; pub struct LabelTemplate { #[serde(rename = "color", skip_serializing_if = "Option::is_none")] pub color: Option, + /// Description provides additional context about the label template's purpose #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(rename = "exclusive", skip_serializing_if = "Option::is_none")] pub exclusive: Option, + /// Name is the display name of the label template #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, } diff --git a/crates/gitea-client/src/models/license_template_info.rs b/crates/gitea-client/src/models/license_template_info.rs index 6d56fdd..f54fbf0 100644 --- a/crates/gitea-client/src/models/license_template_info.rs +++ b/crates/gitea-client/src/models/license_template_info.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,14 +14,19 @@ use serde::{Deserialize, Serialize}; /// LicenseTemplateInfo : LicensesInfo contains information about a License #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LicenseTemplateInfo { + /// Body contains the full text of the license #[serde(rename = "body", skip_serializing_if = "Option::is_none")] pub body: Option, + /// Implementation contains license implementation details #[serde(rename = "implementation", skip_serializing_if = "Option::is_none")] pub implementation: Option, + /// Key is the unique identifier for the license template #[serde(rename = "key", skip_serializing_if = "Option::is_none")] pub key: Option, + /// Name is the display name of the license #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// URL is the reference URL for the license #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/licenses_template_list_entry.rs b/crates/gitea-client/src/models/licenses_template_list_entry.rs index d8a1dfe..d89901d 100644 --- a/crates/gitea-client/src/models/licenses_template_list_entry.rs +++ b/crates/gitea-client/src/models/licenses_template_list_entry.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,10 +14,13 @@ use serde::{Deserialize, Serialize}; /// LicensesTemplateListEntry : LicensesListEntry is used for the API #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LicensesTemplateListEntry { + /// Key is the unique identifier for the license template #[serde(rename = "key", skip_serializing_if = "Option::is_none")] pub key: Option, + /// Name is the display name of the license #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// URL is the reference URL for the license #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/lock_issue_option.rs b/crates/gitea-client/src/models/lock_issue_option.rs new file mode 100644 index 0000000..380799d --- /dev/null +++ b/crates/gitea-client/src/models/lock_issue_option.rs @@ -0,0 +1,29 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// LockIssueOption : LockIssueOption options to lock an issue +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct LockIssueOption { + #[serde(rename = "lock_reason", skip_serializing_if = "Option::is_none")] + pub lock_reason: Option, +} + +impl LockIssueOption { + /// LockIssueOption options to lock an issue + pub fn new() -> LockIssueOption { + LockIssueOption { + lock_reason: None, + } + } +} + diff --git a/crates/gitea-client/src/models/markdown_option.rs b/crates/gitea-client/src/models/markdown_option.rs index c9593d7..ab8a065 100644 --- a/crates/gitea-client/src/models/markdown_option.rs +++ b/crates/gitea-client/src/models/markdown_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -17,13 +17,13 @@ pub struct MarkdownOption { /// URL path for rendering issue, media and file links Expected format: /subpath/{user}/{repo}/src/{branch, commit, tag}/{identifier/path}/{file/dir} in: body #[serde(rename = "Context", skip_serializing_if = "Option::is_none")] pub context: Option, - /// Mode to render (comment, gfm, markdown) in: body + /// Mode to render (markdown, comment, wiki, file) in: body #[serde(rename = "Mode", skip_serializing_if = "Option::is_none")] pub mode: Option, /// Text markdown to render in: body #[serde(rename = "Text", skip_serializing_if = "Option::is_none")] pub text: Option, - /// Is it a wiki page ? in: body + /// Is it a wiki page? (use mode=wiki instead) Deprecated: true in: body #[serde(rename = "Wiki", skip_serializing_if = "Option::is_none")] pub wiki: Option, } diff --git a/crates/gitea-client/src/models/markup_option.rs b/crates/gitea-client/src/models/markup_option.rs index 2c05980..1781b37 100644 --- a/crates/gitea-client/src/models/markup_option.rs +++ b/crates/gitea-client/src/models/markup_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -20,13 +20,13 @@ pub struct MarkupOption { /// File path for detecting extension in file mode in: body #[serde(rename = "FilePath", skip_serializing_if = "Option::is_none")] pub file_path: Option, - /// Mode to render (comment, gfm, markdown, file) in: body + /// Mode to render (markdown, comment, wiki, file) in: body #[serde(rename = "Mode", skip_serializing_if = "Option::is_none")] pub mode: Option, /// Text markup to render in: body #[serde(rename = "Text", skip_serializing_if = "Option::is_none")] pub text: Option, - /// Is it a wiki page ? in: body + /// Is it a wiki page? (use mode=wiki instead) Deprecated: true in: body #[serde(rename = "Wiki", skip_serializing_if = "Option::is_none")] pub wiki: Option, } diff --git a/crates/gitea-client/src/models/merge_pull_request_option.rs b/crates/gitea-client/src/models/merge_pull_request_option.rs index 3650370..a49de81 100644 --- a/crates/gitea-client/src/models/merge_pull_request_option.rs +++ b/crates/gitea-client/src/models/merge_pull_request_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/merge_upstream_request.rs b/crates/gitea-client/src/models/merge_upstream_request.rs new file mode 100644 index 0000000..d96755d --- /dev/null +++ b/crates/gitea-client/src/models/merge_upstream_request.rs @@ -0,0 +1,30 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct MergeUpstreamRequest { + #[serde(rename = "branch", skip_serializing_if = "Option::is_none")] + pub branch: Option, + #[serde(rename = "ff_only", skip_serializing_if = "Option::is_none")] + pub ff_only: Option, +} + +impl MergeUpstreamRequest { + pub fn new() -> MergeUpstreamRequest { + MergeUpstreamRequest { + branch: None, + ff_only: None, + } + } +} + diff --git a/crates/gitea-client/src/models/merge_upstream_response.rs b/crates/gitea-client/src/models/merge_upstream_response.rs new file mode 100644 index 0000000..ef57193 --- /dev/null +++ b/crates/gitea-client/src/models/merge_upstream_response.rs @@ -0,0 +1,27 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct MergeUpstreamResponse { + #[serde(rename = "merge_type", skip_serializing_if = "Option::is_none")] + pub merge_type: Option, +} + +impl MergeUpstreamResponse { + pub fn new() -> MergeUpstreamResponse { + MergeUpstreamResponse { + merge_type: None, + } + } +} + diff --git a/crates/gitea-client/src/models/migrate_repo_options.rs b/crates/gitea-client/src/models/migrate_repo_options.rs index 77bb926..8022973 100644 --- a/crates/gitea-client/src/models/migrate_repo_options.rs +++ b/crates/gitea-client/src/models/migrate_repo_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -20,6 +20,10 @@ pub struct MigrateRepoOptions { pub auth_token: Option, #[serde(rename = "auth_username", skip_serializing_if = "Option::is_none")] pub auth_username: Option, + #[serde(rename = "aws_access_key_id", skip_serializing_if = "Option::is_none")] + pub aws_access_key_id: Option, + #[serde(rename = "aws_secret_access_key", skip_serializing_if = "Option::is_none")] + pub aws_secret_access_key: Option, #[serde(rename = "clone_addr")] pub clone_addr: String, #[serde(rename = "description", skip_serializing_if = "Option::is_none")] @@ -46,12 +50,12 @@ pub struct MigrateRepoOptions { pub releases: Option, #[serde(rename = "repo_name")] pub repo_name: String, - /// Name of User or Organisation who will own Repo after migration + /// the organization's name or individual user's name who will own the migrated repository #[serde(rename = "repo_owner", skip_serializing_if = "Option::is_none")] pub repo_owner: Option, #[serde(rename = "service", skip_serializing_if = "Option::is_none")] pub service: Option, - /// deprecated (only for backwards compatibility) + /// deprecated (only for backwards compatibility, use repo_owner instead) #[serde(rename = "uid", skip_serializing_if = "Option::is_none")] pub uid: Option, #[serde(rename = "wiki", skip_serializing_if = "Option::is_none")] @@ -65,6 +69,8 @@ impl MigrateRepoOptions { auth_password: None, auth_token: None, auth_username: None, + aws_access_key_id: None, + aws_secret_access_key: None, clone_addr, description: None, issues: None, @@ -104,6 +110,8 @@ pub enum Service { Gitbucket, #[serde(rename = "codebase")] Codebase, + #[serde(rename = "codecommit")] + Codecommit, } impl Default for Service { diff --git a/crates/gitea-client/src/models/milestone.rs b/crates/gitea-client/src/models/milestone.rs index e69cd93..8c75a05 100644 --- a/crates/gitea-client/src/models/milestone.rs +++ b/crates/gitea-client/src/models/milestone.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,21 +16,26 @@ use serde::{Deserialize, Serialize}; pub struct Milestone { #[serde(rename = "closed_at", skip_serializing_if = "Option::is_none")] pub closed_at: Option, + /// ClosedIssues is the number of closed issues in this milestone #[serde(rename = "closed_issues", skip_serializing_if = "Option::is_none")] pub closed_issues: Option, #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, + /// Description provides details about the milestone #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(rename = "due_on", skip_serializing_if = "Option::is_none")] pub due_on: Option, + /// ID is the unique identifier for the milestone #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// OpenIssues is the number of open issues in this milestone #[serde(rename = "open_issues", skip_serializing_if = "Option::is_none")] pub open_issues: Option, /// StateType issue state type #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option, + /// Title is the title of the milestone #[serde(rename = "title", skip_serializing_if = "Option::is_none")] pub title: Option, #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/mod.rs b/crates/gitea-client/src/models/mod.rs index c16f7b2..a85bb96 100644 --- a/crates/gitea-client/src/models/mod.rs +++ b/crates/gitea-client/src/models/mod.rs @@ -1,7 +1,35 @@ pub mod access_token; pub use self::access_token::AccessToken; +pub mod action_artifact; +pub use self::action_artifact::ActionArtifact; +pub mod action_artifacts_response; +pub use self::action_artifacts_response::ActionArtifactsResponse; +pub mod action_runner; +pub use self::action_runner::ActionRunner; +pub mod action_runner_label; +pub use self::action_runner_label::ActionRunnerLabel; +pub mod action_runners_response; +pub use self::action_runners_response::ActionRunnersResponse; +pub mod action_task; +pub use self::action_task::ActionTask; +pub mod action_task_response; +pub use self::action_task_response::ActionTaskResponse; pub mod action_variable; pub use self::action_variable::ActionVariable; +pub mod action_workflow; +pub use self::action_workflow::ActionWorkflow; +pub mod action_workflow_job; +pub use self::action_workflow_job::ActionWorkflowJob; +pub mod action_workflow_jobs_response; +pub use self::action_workflow_jobs_response::ActionWorkflowJobsResponse; +pub mod action_workflow_response; +pub use self::action_workflow_response::ActionWorkflowResponse; +pub mod action_workflow_run; +pub use self::action_workflow_run::ActionWorkflowRun; +pub mod action_workflow_runs_response; +pub use self::action_workflow_runs_response::ActionWorkflowRunsResponse; +pub mod action_workflow_step; +pub use self::action_workflow_step::ActionWorkflowStep; pub mod activity; pub use self::activity::Activity; pub mod activity_pub; @@ -16,6 +44,8 @@ pub mod annotated_tag_object; pub use self::annotated_tag_object::AnnotatedTagObject; pub mod api_error; pub use self::api_error::ApiError; +pub mod apply_diff_patch_file_options; +pub use self::apply_diff_patch_file_options::ApplyDiffPatchFileOptions; pub mod attachment; pub use self::attachment::Attachment; pub mod badge; @@ -50,10 +80,14 @@ pub mod commit_user; pub use self::commit_user::CommitUser; pub mod compare; pub use self::compare::Compare; +pub mod contents_ext_response; +pub use self::contents_ext_response::ContentsExtResponse; pub mod contents_response; pub use self::contents_response::ContentsResponse; pub mod create_access_token_option; pub use self::create_access_token_option::CreateAccessTokenOption; +pub mod create_action_workflow_dispatch; +pub use self::create_action_workflow_dispatch::CreateActionWorkflowDispatch; pub mod create_branch_protection_option; pub use self::create_branch_protection_option::CreateBranchProtectionOption; pub mod create_branch_repo_option; @@ -100,6 +134,8 @@ pub mod create_status_option; pub use self::create_status_option::CreateStatusOption; pub mod create_tag_option; pub use self::create_tag_option::CreateTagOption; +pub mod create_tag_protection_option; +pub use self::create_tag_protection_option::CreateTagProtectionOption; pub mod create_team_option; pub use self::create_team_option::CreateTeamOption; pub mod create_user_option; @@ -146,6 +182,8 @@ pub mod edit_release_option; pub use self::edit_release_option::EditReleaseOption; pub mod edit_repo_option; pub use self::edit_repo_option::EditRepoOption; +pub mod edit_tag_protection_option; +pub use self::edit_tag_protection_option::EditTagProtectionOption; pub mod edit_team_option; pub use self::edit_team_option::EditTeamOption; pub mod edit_user_option; @@ -176,6 +214,8 @@ pub mod general_ui_settings; pub use self::general_ui_settings::GeneralUiSettings; pub mod generate_repo_option; pub use self::generate_repo_option::GenerateRepoOption; +pub mod get_files_options; +pub use self::get_files_options::GetFilesOptions; pub mod git_blob_response; pub use self::git_blob_response::GitBlobResponse; pub mod git_entry; @@ -224,12 +264,18 @@ pub mod license_template_info; pub use self::license_template_info::LicenseTemplateInfo; pub mod licenses_template_list_entry; pub use self::licenses_template_list_entry::LicensesTemplateListEntry; +pub mod lock_issue_option; +pub use self::lock_issue_option::LockIssueOption; pub mod markdown_option; pub use self::markdown_option::MarkdownOption; pub mod markup_option; pub use self::markup_option::MarkupOption; pub mod merge_pull_request_option; pub use self::merge_pull_request_option::MergePullRequestOption; +pub mod merge_upstream_request; +pub use self::merge_upstream_request::MergeUpstreamRequest; +pub mod merge_upstream_response; +pub use self::merge_upstream_response::MergeUpstreamResponse; pub mod migrate_repo_options; pub use self::migrate_repo_options::MigrateRepoOptions; pub mod milestone; @@ -294,6 +340,10 @@ pub mod reference; pub use self::reference::Reference; pub mod release; pub use self::release::Release; +pub mod rename_branch_repo_option; +pub use self::rename_branch_repo_option::RenameBranchRepoOption; +pub mod rename_org_option; +pub use self::rename_org_option::RenameOrgOption; pub mod rename_user_option; pub use self::rename_user_option::RenameUserOption; pub mod repo_collaborator_permission; @@ -322,6 +372,8 @@ pub mod submit_pull_review_options; pub use self::submit_pull_review_options::SubmitPullReviewOptions; pub mod tag; pub use self::tag::Tag; +pub mod tag_protection; +pub use self::tag_protection::TagProtection; pub mod team; pub use self::team::Team; pub mod team_search_200_response; @@ -336,6 +388,8 @@ pub mod tracked_time; pub use self::tracked_time::TrackedTime; pub mod transfer_repo_option; pub use self::transfer_repo_option::TransferRepoOption; +pub mod update_branch_protection_priories; +pub use self::update_branch_protection_priories::UpdateBranchProtectionPriories; pub mod update_file_options; pub use self::update_file_options::UpdateFileOptions; pub mod update_repo_avatar_option; diff --git a/crates/gitea-client/src/models/new_issue_pins_allowed.rs b/crates/gitea-client/src/models/new_issue_pins_allowed.rs index e9591fa..0e8935c 100644 --- a/crates/gitea-client/src/models/new_issue_pins_allowed.rs +++ b/crates/gitea-client/src/models/new_issue_pins_allowed.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/node_info.rs b/crates/gitea-client/src/models/node_info.rs index fb967e2..0461c39 100644 --- a/crates/gitea-client/src/models/node_info.rs +++ b/crates/gitea-client/src/models/node_info.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,10 +14,13 @@ use serde::{Deserialize, Serialize}; /// NodeInfo : NodeInfo contains standardized way of exposing metadata about a server running one of the distributed social networks #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NodeInfo { + /// Metadata contains free form key value pairs for software specific values #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")] pub metadata: Option, + /// OpenRegistrations indicates if new user registrations are accepted #[serde(rename = "openRegistrations", skip_serializing_if = "Option::is_none")] pub open_registrations: Option, + /// Protocols lists the protocols supported by this server #[serde(rename = "protocols", skip_serializing_if = "Option::is_none")] pub protocols: Option>, #[serde(rename = "services", skip_serializing_if = "Option::is_none")] @@ -26,6 +29,7 @@ pub struct NodeInfo { pub software: Option>, #[serde(rename = "usage", skip_serializing_if = "Option::is_none")] pub usage: Option>, + /// Version specifies the schema version #[serde(rename = "version", skip_serializing_if = "Option::is_none")] pub version: Option, } diff --git a/crates/gitea-client/src/models/node_info_services.rs b/crates/gitea-client/src/models/node_info_services.rs index 6762f57..ab39362 100644 --- a/crates/gitea-client/src/models/node_info_services.rs +++ b/crates/gitea-client/src/models/node_info_services.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,8 +14,10 @@ use serde::{Deserialize, Serialize}; /// NodeInfoServices : NodeInfoServices contains the third party sites this server can connect to via their application API #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NodeInfoServices { + /// Inbound lists services that can deliver content to this server #[serde(rename = "inbound", skip_serializing_if = "Option::is_none")] pub inbound: Option>, + /// Outbound lists services this server can deliver content to #[serde(rename = "outbound", skip_serializing_if = "Option::is_none")] pub outbound: Option>, } diff --git a/crates/gitea-client/src/models/node_info_software.rs b/crates/gitea-client/src/models/node_info_software.rs index fe93eb9..45e8c3e 100644 --- a/crates/gitea-client/src/models/node_info_software.rs +++ b/crates/gitea-client/src/models/node_info_software.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,12 +14,16 @@ use serde::{Deserialize, Serialize}; /// NodeInfoSoftware : NodeInfoSoftware contains Metadata about server software in use #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NodeInfoSoftware { + /// Homepage is the URL to the homepage of this server software #[serde(rename = "homepage", skip_serializing_if = "Option::is_none")] pub homepage: Option, + /// Name is the canonical name of this server software #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// Repository is the URL to the source code repository #[serde(rename = "repository", skip_serializing_if = "Option::is_none")] pub repository: Option, + /// Version is the version of this server software #[serde(rename = "version", skip_serializing_if = "Option::is_none")] pub version: Option, } diff --git a/crates/gitea-client/src/models/node_info_usage.rs b/crates/gitea-client/src/models/node_info_usage.rs index dc1a064..a74dfeb 100644 --- a/crates/gitea-client/src/models/node_info_usage.rs +++ b/crates/gitea-client/src/models/node_info_usage.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,8 +14,10 @@ use serde::{Deserialize, Serialize}; /// NodeInfoUsage : NodeInfoUsage contains usage statistics for this server #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NodeInfoUsage { + /// LocalComments is the total amount of comments made by users local to this server #[serde(rename = "localComments", skip_serializing_if = "Option::is_none")] pub local_comments: Option, + /// LocalPosts is the total amount of posts made by users local to this server #[serde(rename = "localPosts", skip_serializing_if = "Option::is_none")] pub local_posts: Option, #[serde(rename = "users", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/node_info_usage_users.rs b/crates/gitea-client/src/models/node_info_usage_users.rs index 7bcc4cb..d7baea3 100644 --- a/crates/gitea-client/src/models/node_info_usage_users.rs +++ b/crates/gitea-client/src/models/node_info_usage_users.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,10 +14,13 @@ use serde::{Deserialize, Serialize}; /// NodeInfoUsageUsers : NodeInfoUsageUsers contains statistics about the users of this server #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NodeInfoUsageUsers { + /// ActiveHalfyear is the amount of users that signed in at least once in the last 180 days #[serde(rename = "activeHalfyear", skip_serializing_if = "Option::is_none")] pub active_halfyear: Option, + /// ActiveMonth is the amount of users that signed in at least once in the last 30 days #[serde(rename = "activeMonth", skip_serializing_if = "Option::is_none")] pub active_month: Option, + /// Total is the total amount of users on this server #[serde(rename = "total", skip_serializing_if = "Option::is_none")] pub total: Option, } diff --git a/crates/gitea-client/src/models/note.rs b/crates/gitea-client/src/models/note.rs index 4f78ccc..6acf638 100644 --- a/crates/gitea-client/src/models/note.rs +++ b/crates/gitea-client/src/models/note.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,6 +16,7 @@ use serde::{Deserialize, Serialize}; pub struct Note { #[serde(rename = "commit", skip_serializing_if = "Option::is_none")] pub commit: Option>, + /// The content message of the git note #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, } diff --git a/crates/gitea-client/src/models/notification_count.rs b/crates/gitea-client/src/models/notification_count.rs index ba6aa42..5316f3b 100644 --- a/crates/gitea-client/src/models/notification_count.rs +++ b/crates/gitea-client/src/models/notification_count.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize}; /// NotificationCount : NotificationCount number of unread notifications #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NotificationCount { + /// New is the number of unread notifications #[serde(rename = "new", skip_serializing_if = "Option::is_none")] pub new: Option, } diff --git a/crates/gitea-client/src/models/notification_subject.rs b/crates/gitea-client/src/models/notification_subject.rs index 6b338ba..de13809 100644 --- a/crates/gitea-client/src/models/notification_subject.rs +++ b/crates/gitea-client/src/models/notification_subject.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,20 +14,25 @@ use serde::{Deserialize, Serialize}; /// NotificationSubject : NotificationSubject contains the notification subject (Issue/Pull/Commit) #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NotificationSubject { + /// HTMLURL is the web URL for the notification subject #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] pub html_url: Option, + /// LatestCommentHTMLURL is the web URL for the latest comment #[serde(rename = "latest_comment_html_url", skip_serializing_if = "Option::is_none")] pub latest_comment_html_url: Option, + /// LatestCommentURL is the API URL for the latest comment #[serde(rename = "latest_comment_url", skip_serializing_if = "Option::is_none")] pub latest_comment_url: Option, /// StateType issue state type #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option, + /// Title is the title of the notification subject #[serde(rename = "title", skip_serializing_if = "Option::is_none")] pub title: Option, /// NotifySubjectType represent type of notification subject #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub r#type: Option, + /// URL is the API URL for the notification subject #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/notification_thread.rs b/crates/gitea-client/src/models/notification_thread.rs index e5ef00a..1d4bec3 100644 --- a/crates/gitea-client/src/models/notification_thread.rs +++ b/crates/gitea-client/src/models/notification_thread.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,18 +14,23 @@ use serde::{Deserialize, Serialize}; /// NotificationThread : NotificationThread expose Notification on API #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NotificationThread { + /// ID is the unique identifier for the notification thread #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// Pinned indicates if the notification is pinned #[serde(rename = "pinned", skip_serializing_if = "Option::is_none")] pub pinned: Option, #[serde(rename = "repository", skip_serializing_if = "Option::is_none")] pub repository: Option>, #[serde(rename = "subject", skip_serializing_if = "Option::is_none")] pub subject: Option>, + /// Unread indicates if the notification has been read #[serde(rename = "unread", skip_serializing_if = "Option::is_none")] pub unread: Option, + /// UpdatedAt is the time when the notification was last updated #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] pub updated_at: Option, + /// URL is the API URL for this notification thread #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/o_auth2_application.rs b/crates/gitea-client/src/models/o_auth2_application.rs index 614f4e8..8699015 100644 --- a/crates/gitea-client/src/models/o_auth2_application.rs +++ b/crates/gitea-client/src/models/o_auth2_application.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -13,20 +13,30 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct OAuth2Application { + /// The client ID of the OAuth2 application #[serde(rename = "client_id", skip_serializing_if = "Option::is_none")] pub client_id: Option, + /// The client secret of the OAuth2 application #[serde(rename = "client_secret", skip_serializing_if = "Option::is_none")] pub client_secret: Option, + /// Whether the client is confidential #[serde(rename = "confidential_client", skip_serializing_if = "Option::is_none")] pub confidential_client: Option, + /// The timestamp when the application was created #[serde(rename = "created", skip_serializing_if = "Option::is_none")] pub created: Option, + /// The unique identifier of the OAuth2 application #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// The name of the OAuth2 application #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// The list of allowed redirect URIs #[serde(rename = "redirect_uris", skip_serializing_if = "Option::is_none")] pub redirect_uris: Option>, + /// Whether to skip secondary authorization + #[serde(rename = "skip_secondary_authorization", skip_serializing_if = "Option::is_none")] + pub skip_secondary_authorization: Option, } impl OAuth2Application { @@ -39,6 +49,7 @@ impl OAuth2Application { id: None, name: None, redirect_uris: None, + skip_secondary_authorization: None, } } } diff --git a/crates/gitea-client/src/models/organization.rs b/crates/gitea-client/src/models/organization.rs index 5c0e2c2..9898f0c 100644 --- a/crates/gitea-client/src/models/organization.rs +++ b/crates/gitea-client/src/models/organization.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,27 +14,37 @@ use serde::{Deserialize, Serialize}; /// Organization : Organization represents an organization #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Organization { + /// The URL of the organization's avatar #[serde(rename = "avatar_url", skip_serializing_if = "Option::is_none")] pub avatar_url: Option, + /// The description of the organization #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, + /// The email address of the organization #[serde(rename = "email", skip_serializing_if = "Option::is_none")] pub email: Option, + /// The full display name of the organization #[serde(rename = "full_name", skip_serializing_if = "Option::is_none")] pub full_name: Option, + /// The unique identifier of the organization #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// The location of the organization #[serde(rename = "location", skip_serializing_if = "Option::is_none")] pub location: Option, + /// The name of the organization #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// Whether repository administrators can change team access #[serde(rename = "repo_admin_change_team_access", skip_serializing_if = "Option::is_none")] pub repo_admin_change_team_access: Option, - /// deprecated + /// username of the organization deprecated #[serde(rename = "username", skip_serializing_if = "Option::is_none")] pub username: Option, + /// The visibility level of the organization (public, limited, private) #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, + /// The website URL of the organization #[serde(rename = "website", skip_serializing_if = "Option::is_none")] pub website: Option, } diff --git a/crates/gitea-client/src/models/organization_permissions.rs b/crates/gitea-client/src/models/organization_permissions.rs index 68e2b59..cd7428f 100644 --- a/crates/gitea-client/src/models/organization_permissions.rs +++ b/crates/gitea-client/src/models/organization_permissions.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,14 +14,19 @@ use serde::{Deserialize, Serialize}; /// OrganizationPermissions : OrganizationPermissions list different users permissions on an organization #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct OrganizationPermissions { + /// Whether the user can create repositories in the organization #[serde(rename = "can_create_repository", skip_serializing_if = "Option::is_none")] pub can_create_repository: Option, + /// Whether the user can read the organization #[serde(rename = "can_read", skip_serializing_if = "Option::is_none")] pub can_read: Option, + /// Whether the user can write to the organization #[serde(rename = "can_write", skip_serializing_if = "Option::is_none")] pub can_write: Option, + /// Whether the user is an admin of the organization #[serde(rename = "is_admin", skip_serializing_if = "Option::is_none")] pub is_admin: Option, + /// Whether the user is an owner of the organization #[serde(rename = "is_owner", skip_serializing_if = "Option::is_none")] pub is_owner: Option, } diff --git a/crates/gitea-client/src/models/package.rs b/crates/gitea-client/src/models/package.rs index b3dad28..82dd946 100644 --- a/crates/gitea-client/src/models/package.rs +++ b/crates/gitea-client/src/models/package.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -18,18 +18,23 @@ pub struct Package { pub created_at: Option, #[serde(rename = "creator", skip_serializing_if = "Option::is_none")] pub creator: Option>, + /// The HTML URL to view the package #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] pub html_url: Option, + /// The unique identifier of the package #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// The name of the package #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, #[serde(rename = "owner", skip_serializing_if = "Option::is_none")] pub owner: Option>, #[serde(rename = "repository", skip_serializing_if = "Option::is_none")] pub repository: Option>, + /// The type of the package (e.g., npm, maven, docker) #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub r#type: Option, + /// The version of the package #[serde(rename = "version", skip_serializing_if = "Option::is_none")] pub version: Option, } diff --git a/crates/gitea-client/src/models/package_file.rs b/crates/gitea-client/src/models/package_file.rs index d32b9de..5926c8a 100644 --- a/crates/gitea-client/src/models/package_file.rs +++ b/crates/gitea-client/src/models/package_file.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,33 +14,40 @@ use serde::{Deserialize, Serialize}; /// PackageFile : PackageFile represents a package file #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PackageFile { - #[serde(rename = "Size", skip_serializing_if = "Option::is_none")] - pub size: Option, + /// The unique identifier of the package file #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// The MD5 hash of the package file #[serde(rename = "md5", skip_serializing_if = "Option::is_none")] pub md5: Option, + /// The name of the package file #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// The SHA1 hash of the package file #[serde(rename = "sha1", skip_serializing_if = "Option::is_none")] pub sha1: Option, + /// The SHA256 hash of the package file #[serde(rename = "sha256", skip_serializing_if = "Option::is_none")] pub sha256: Option, + /// The SHA512 hash of the package file #[serde(rename = "sha512", skip_serializing_if = "Option::is_none")] pub sha512: Option, + /// The size of the package file in bytes + #[serde(rename = "size", skip_serializing_if = "Option::is_none")] + pub size: Option, } impl PackageFile { /// PackageFile represents a package file pub fn new() -> PackageFile { PackageFile { - size: None, id: None, md5: None, name: None, sha1: None, sha256: None, sha512: None, + size: None, } } } diff --git a/crates/gitea-client/src/models/payload_commit.rs b/crates/gitea-client/src/models/payload_commit.rs index 73704c9..d8ff2ce 100644 --- a/crates/gitea-client/src/models/payload_commit.rs +++ b/crates/gitea-client/src/models/payload_commit.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize}; /// PayloadCommit : PayloadCommit represents a commit #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PayloadCommit { + /// List of files added in this commit #[serde(rename = "added", skip_serializing_if = "Option::is_none")] pub added: Option>, #[serde(rename = "author", skip_serializing_if = "Option::is_none")] @@ -23,14 +24,18 @@ pub struct PayloadCommit { /// sha1 hash of the commit #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// The commit message #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, + /// List of files modified in this commit #[serde(rename = "modified", skip_serializing_if = "Option::is_none")] pub modified: Option>, + /// List of files removed in this commit #[serde(rename = "removed", skip_serializing_if = "Option::is_none")] pub removed: Option>, #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")] pub timestamp: Option, + /// The URL to view this commit #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, #[serde(rename = "verification", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/payload_commit_verification.rs b/crates/gitea-client/src/models/payload_commit_verification.rs index 8a6117d..7a8742e 100644 --- a/crates/gitea-client/src/models/payload_commit_verification.rs +++ b/crates/gitea-client/src/models/payload_commit_verification.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,14 +14,18 @@ use serde::{Deserialize, Serialize}; /// PayloadCommitVerification : PayloadCommitVerification represents the GPG verification of a commit #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PayloadCommitVerification { + /// The signed payload content #[serde(rename = "payload", skip_serializing_if = "Option::is_none")] pub payload: Option, + /// The reason for the verification status #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option, + /// The GPG signature of the commit #[serde(rename = "signature", skip_serializing_if = "Option::is_none")] pub signature: Option, #[serde(rename = "signer", skip_serializing_if = "Option::is_none")] pub signer: Option>, + /// Whether the commit signature is verified #[serde(rename = "verified", skip_serializing_if = "Option::is_none")] pub verified: Option, } diff --git a/crates/gitea-client/src/models/payload_user.rs b/crates/gitea-client/src/models/payload_user.rs index e980467..8bac2c5 100644 --- a/crates/gitea-client/src/models/payload_user.rs +++ b/crates/gitea-client/src/models/payload_user.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -19,6 +19,7 @@ pub struct PayloadUser { /// Full name of the commit author #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// username of the user #[serde(rename = "username", skip_serializing_if = "Option::is_none")] pub username: Option, } diff --git a/crates/gitea-client/src/models/permission.rs b/crates/gitea-client/src/models/permission.rs index a76a4f8..0ad0eed 100644 --- a/crates/gitea-client/src/models/permission.rs +++ b/crates/gitea-client/src/models/permission.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/pr_branch_info.rs b/crates/gitea-client/src/models/pr_branch_info.rs index f5c9fb5..cdb3a4c 100644 --- a/crates/gitea-client/src/models/pr_branch_info.rs +++ b/crates/gitea-client/src/models/pr_branch_info.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,14 +14,18 @@ use serde::{Deserialize, Serialize}; /// PrBranchInfo : PRBranchInfo information about a branch #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PrBranchInfo { + /// The display name of the branch #[serde(rename = "label", skip_serializing_if = "Option::is_none")] pub label: Option, + /// The git reference of the branch #[serde(rename = "ref", skip_serializing_if = "Option::is_none")] pub r#ref: Option, #[serde(rename = "repo", skip_serializing_if = "Option::is_none")] pub repo: Option>, + /// The unique identifier of the repository #[serde(rename = "repo_id", skip_serializing_if = "Option::is_none")] pub repo_id: Option, + /// The commit SHA of the branch head #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, } diff --git a/crates/gitea-client/src/models/public_key.rs b/crates/gitea-client/src/models/public_key.rs index a198ebe..2d4808c 100644 --- a/crates/gitea-client/src/models/public_key.rs +++ b/crates/gitea-client/src/models/public_key.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,18 +16,28 @@ use serde::{Deserialize, Serialize}; pub struct PublicKey { #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, + /// Fingerprint is the key's fingerprint #[serde(rename = "fingerprint", skip_serializing_if = "Option::is_none")] pub fingerprint: Option, + /// ID is the unique identifier for the public key #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// Key contains the actual SSH public key content #[serde(rename = "key", skip_serializing_if = "Option::is_none")] pub key: Option, + /// KeyType indicates the type of the SSH key #[serde(rename = "key_type", skip_serializing_if = "Option::is_none")] pub key_type: Option, + /// Updated is the time when the key was last used + #[serde(rename = "last_used_at", skip_serializing_if = "Option::is_none")] + pub last_used_at: Option, + /// ReadOnly indicates if the key has read-only access #[serde(rename = "read_only", skip_serializing_if = "Option::is_none")] pub read_only: Option, + /// Title is the human-readable name for the key #[serde(rename = "title", skip_serializing_if = "Option::is_none")] pub title: Option, + /// URL is the API URL for this key #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, #[serde(rename = "user", skip_serializing_if = "Option::is_none")] @@ -43,6 +53,7 @@ impl PublicKey { id: None, key: None, key_type: None, + last_used_at: None, read_only: None, title: None, url: None, diff --git a/crates/gitea-client/src/models/pull_request.rs b/crates/gitea-client/src/models/pull_request.rs index eec7d7d..4486357 100644 --- a/crates/gitea-client/src/models/pull_request.rs +++ b/crates/gitea-client/src/models/pull_request.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,50 +14,67 @@ use serde::{Deserialize, Serialize}; /// PullRequest : PullRequest represents a pull request #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PullRequest { + /// The number of lines added in the pull request #[serde(rename = "additions", skip_serializing_if = "Option::is_none")] pub additions: Option, + /// Whether maintainers can edit the pull request #[serde(rename = "allow_maintainer_edit", skip_serializing_if = "Option::is_none")] pub allow_maintainer_edit: Option, #[serde(rename = "assignee", skip_serializing_if = "Option::is_none")] pub assignee: Option>, + /// The list of users assigned to the pull request #[serde(rename = "assignees", skip_serializing_if = "Option::is_none")] pub assignees: Option>, #[serde(rename = "base", skip_serializing_if = "Option::is_none")] pub base: Option>, + /// The description body of the pull request #[serde(rename = "body", skip_serializing_if = "Option::is_none")] pub body: Option, + /// The number of files changed in the pull request #[serde(rename = "changed_files", skip_serializing_if = "Option::is_none")] pub changed_files: Option, #[serde(rename = "closed_at", skip_serializing_if = "Option::is_none")] pub closed_at: Option, + /// The number of comments on the pull request #[serde(rename = "comments", skip_serializing_if = "Option::is_none")] pub comments: Option, #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, + /// The number of lines deleted in the pull request #[serde(rename = "deletions", skip_serializing_if = "Option::is_none")] pub deletions: Option, + /// The URL to download the diff patch #[serde(rename = "diff_url", skip_serializing_if = "Option::is_none")] pub diff_url: Option, + /// Whether the pull request is a draft #[serde(rename = "draft", skip_serializing_if = "Option::is_none")] pub draft: Option, #[serde(rename = "due_date", skip_serializing_if = "Option::is_none")] pub due_date: Option, #[serde(rename = "head", skip_serializing_if = "Option::is_none")] pub head: Option>, + /// The HTML URL to view the pull request #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] pub html_url: Option, + /// The unique identifier of the pull request #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// Whether the pull request conversation is locked #[serde(rename = "is_locked", skip_serializing_if = "Option::is_none")] pub is_locked: Option, + /// The labels attached to the pull request #[serde(rename = "labels", skip_serializing_if = "Option::is_none")] pub labels: Option>, + /// The merge base commit SHA #[serde(rename = "merge_base", skip_serializing_if = "Option::is_none")] pub merge_base: Option, + /// The SHA of the merge commit #[serde(rename = "merge_commit_sha", skip_serializing_if = "Option::is_none")] pub merge_commit_sha: Option, + /// Whether the pull request can be merged #[serde(rename = "mergeable", skip_serializing_if = "Option::is_none")] pub mergeable: Option, + /// Whether the pull request has been merged #[serde(rename = "merged", skip_serializing_if = "Option::is_none")] pub merged: Option, #[serde(rename = "merged_at", skip_serializing_if = "Option::is_none")] @@ -66,24 +83,33 @@ pub struct PullRequest { pub merged_by: Option>, #[serde(rename = "milestone", skip_serializing_if = "Option::is_none")] pub milestone: Option>, + /// The pull request number #[serde(rename = "number", skip_serializing_if = "Option::is_none")] pub number: Option, + /// The URL to download the patch file #[serde(rename = "patch_url", skip_serializing_if = "Option::is_none")] pub patch_url: Option, + /// The pin order for the pull request #[serde(rename = "pin_order", skip_serializing_if = "Option::is_none")] pub pin_order: Option, + /// The users requested to review the pull request #[serde(rename = "requested_reviewers", skip_serializing_if = "Option::is_none")] pub requested_reviewers: Option>, + /// The teams requested to review the pull request + #[serde(rename = "requested_reviewers_teams", skip_serializing_if = "Option::is_none")] + pub requested_reviewers_teams: Option>, /// number of review comments made on the diff of a PR review (not including comments on commits or issues in a PR) #[serde(rename = "review_comments", skip_serializing_if = "Option::is_none")] pub review_comments: Option, /// StateType issue state type #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option, + /// The title of the pull request #[serde(rename = "title", skip_serializing_if = "Option::is_none")] pub title: Option, #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] pub updated_at: Option, + /// The API URL of the pull request #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, #[serde(rename = "user", skip_serializing_if = "Option::is_none")] @@ -124,6 +150,7 @@ impl PullRequest { patch_url: None, pin_order: None, requested_reviewers: None, + requested_reviewers_teams: None, review_comments: None, state: None, title: None, diff --git a/crates/gitea-client/src/models/pull_request_meta.rs b/crates/gitea-client/src/models/pull_request_meta.rs index ed29b40..4b97432 100644 --- a/crates/gitea-client/src/models/pull_request_meta.rs +++ b/crates/gitea-client/src/models/pull_request_meta.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/pull_review.rs b/crates/gitea-client/src/models/pull_review.rs index 12dabed..fe3c730 100644 --- a/crates/gitea-client/src/models/pull_review.rs +++ b/crates/gitea-client/src/models/pull_review.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -22,12 +22,14 @@ pub struct PullReview { pub commit_id: Option, #[serde(rename = "dismissed", skip_serializing_if = "Option::is_none")] pub dismissed: Option, + /// HTMLURL is the web URL for viewing the review #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] pub html_url: Option, #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, #[serde(rename = "official", skip_serializing_if = "Option::is_none")] pub official: Option, + /// HTMLPullURL is the web URL for the pull request #[serde(rename = "pull_request_url", skip_serializing_if = "Option::is_none")] pub pull_request_url: Option, #[serde(rename = "stale", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/pull_review_comment.rs b/crates/gitea-client/src/models/pull_review_comment.rs index 503e372..8aa98e7 100644 --- a/crates/gitea-client/src/models/pull_review_comment.rs +++ b/crates/gitea-client/src/models/pull_review_comment.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/pull_review_request_options.rs b/crates/gitea-client/src/models/pull_review_request_options.rs index 3e4377a..70a04f8 100644 --- a/crates/gitea-client/src/models/pull_review_request_options.rs +++ b/crates/gitea-client/src/models/pull_review_request_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/push_mirror.rs b/crates/gitea-client/src/models/push_mirror.rs index 1c2e824..560156c 100644 --- a/crates/gitea-client/src/models/push_mirror.rs +++ b/crates/gitea-client/src/models/push_mirror.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,18 +16,24 @@ use serde::{Deserialize, Serialize}; pub struct PushMirror { #[serde(rename = "created", skip_serializing_if = "Option::is_none")] pub created: Option, + /// The sync interval for automatic updates #[serde(rename = "interval", skip_serializing_if = "Option::is_none")] pub interval: Option, + /// The last error message encountered during sync #[serde(rename = "last_error", skip_serializing_if = "Option::is_none")] pub last_error: Option, #[serde(rename = "last_update", skip_serializing_if = "Option::is_none")] pub last_update: Option, + /// The remote repository URL being mirrored to #[serde(rename = "remote_address", skip_serializing_if = "Option::is_none")] pub remote_address: Option, + /// The name of the remote in the git configuration #[serde(rename = "remote_name", skip_serializing_if = "Option::is_none")] pub remote_name: Option, + /// The name of the source repository #[serde(rename = "repo_name", skip_serializing_if = "Option::is_none")] pub repo_name: Option, + /// Whether to sync on every commit #[serde(rename = "sync_on_commit", skip_serializing_if = "Option::is_none")] pub sync_on_commit: Option, } diff --git a/crates/gitea-client/src/models/reaction.rs b/crates/gitea-client/src/models/reaction.rs index d2e0f5d..079ed0f 100644 --- a/crates/gitea-client/src/models/reaction.rs +++ b/crates/gitea-client/src/models/reaction.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize}; /// Reaction : Reaction contain one reaction #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Reaction { + /// The reaction content (e.g., emoji or reaction type) #[serde(rename = "content", skip_serializing_if = "Option::is_none")] pub content: Option, #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/reference.rs b/crates/gitea-client/src/models/reference.rs index 87a7251..6b30a5c 100644 --- a/crates/gitea-client/src/models/reference.rs +++ b/crates/gitea-client/src/models/reference.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -15,8 +15,10 @@ use serde::{Deserialize, Serialize}; pub struct Reference { #[serde(rename = "object", skip_serializing_if = "Option::is_none")] pub object: Option>, + /// The name of the Git reference (e.g., refs/heads/main) #[serde(rename = "ref", skip_serializing_if = "Option::is_none")] pub r#ref: Option, + /// The URL to access this Git reference #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/release.rs b/crates/gitea-client/src/models/release.rs index d111872..275ac6c 100644 --- a/crates/gitea-client/src/models/release.rs +++ b/crates/gitea-client/src/models/release.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,36 +14,49 @@ use serde::{Deserialize, Serialize}; /// Release : Release represents a repository release #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Release { + /// The files attached to the release #[serde(rename = "assets", skip_serializing_if = "Option::is_none")] pub assets: Option>, #[serde(rename = "author", skip_serializing_if = "Option::is_none")] pub author: Option>, + /// The release notes or description #[serde(rename = "body", skip_serializing_if = "Option::is_none")] pub body: Option, #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, + /// Whether the release is a draft #[serde(rename = "draft", skip_serializing_if = "Option::is_none")] pub draft: Option, + /// The HTML URL to view the release #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] pub html_url: Option, + /// The unique identifier of the release #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// The display title of the release #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// Whether the release is a prerelease #[serde(rename = "prerelease", skip_serializing_if = "Option::is_none")] pub prerelease: Option, #[serde(rename = "published_at", skip_serializing_if = "Option::is_none")] pub published_at: Option, + /// The name of the git tag associated with the release #[serde(rename = "tag_name", skip_serializing_if = "Option::is_none")] pub tag_name: Option, + /// The URL to download the tarball archive #[serde(rename = "tarball_url", skip_serializing_if = "Option::is_none")] pub tarball_url: Option, + /// The target commitish for the release #[serde(rename = "target_commitish", skip_serializing_if = "Option::is_none")] pub target_commitish: Option, + /// The URL template for uploading release assets #[serde(rename = "upload_url", skip_serializing_if = "Option::is_none")] pub upload_url: Option, + /// The API URL of the release #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, + /// The URL to download the zip archive #[serde(rename = "zipball_url", skip_serializing_if = "Option::is_none")] pub zipball_url: Option, } diff --git a/crates/gitea-client/src/models/rename_branch_repo_option.rs b/crates/gitea-client/src/models/rename_branch_repo_option.rs new file mode 100644 index 0000000..ad2601a --- /dev/null +++ b/crates/gitea-client/src/models/rename_branch_repo_option.rs @@ -0,0 +1,30 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// RenameBranchRepoOption : RenameBranchRepoOption options when renaming a branch in a repository +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RenameBranchRepoOption { + /// New branch name + #[serde(rename = "name")] + pub name: String, +} + +impl RenameBranchRepoOption { + /// RenameBranchRepoOption options when renaming a branch in a repository + pub fn new(name: String) -> RenameBranchRepoOption { + RenameBranchRepoOption { + name, + } + } +} + diff --git a/crates/gitea-client/src/models/rename_org_option.rs b/crates/gitea-client/src/models/rename_org_option.rs new file mode 100644 index 0000000..ff0fc6c --- /dev/null +++ b/crates/gitea-client/src/models/rename_org_option.rs @@ -0,0 +1,30 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// RenameOrgOption : RenameOrgOption options when renaming an organization +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RenameOrgOption { + /// New username for this org. This name cannot be in use yet by any other user. + #[serde(rename = "new_name")] + pub new_name: String, +} + +impl RenameOrgOption { + /// RenameOrgOption options when renaming an organization + pub fn new(new_name: String) -> RenameOrgOption { + RenameOrgOption { + new_name, + } + } +} + diff --git a/crates/gitea-client/src/models/rename_user_option.rs b/crates/gitea-client/src/models/rename_user_option.rs index 91d2aec..074fc3d 100644 --- a/crates/gitea-client/src/models/rename_user_option.rs +++ b/crates/gitea-client/src/models/rename_user_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/repo_collaborator_permission.rs b/crates/gitea-client/src/models/repo_collaborator_permission.rs index 8b30322..28b7053 100644 --- a/crates/gitea-client/src/models/repo_collaborator_permission.rs +++ b/crates/gitea-client/src/models/repo_collaborator_permission.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,8 +14,10 @@ use serde::{Deserialize, Serialize}; /// RepoCollaboratorPermission : RepoCollaboratorPermission to get repository permission for a collaborator #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct RepoCollaboratorPermission { + /// Permission level of the collaborator #[serde(rename = "permission", skip_serializing_if = "Option::is_none")] pub permission: Option, + /// RoleName is the name of the permission role #[serde(rename = "role_name", skip_serializing_if = "Option::is_none")] pub role_name: Option, #[serde(rename = "user", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/repo_commit.rs b/crates/gitea-client/src/models/repo_commit.rs index 05ceb4d..24176e2 100644 --- a/crates/gitea-client/src/models/repo_commit.rs +++ b/crates/gitea-client/src/models/repo_commit.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -17,10 +17,12 @@ pub struct RepoCommit { pub author: Option>, #[serde(rename = "committer", skip_serializing_if = "Option::is_none")] pub committer: Option>, + /// Message is the commit message #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, #[serde(rename = "tree", skip_serializing_if = "Option::is_none")] pub tree: Option>, + /// URL is the API URL for the commit #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, #[serde(rename = "verification", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/repo_create_release_attachment_request.rs b/crates/gitea-client/src/models/repo_create_release_attachment_request.rs index 1b02e0a..9fc835c 100644 --- a/crates/gitea-client/src/models/repo_create_release_attachment_request.rs +++ b/crates/gitea-client/src/models/repo_create_release_attachment_request.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/repo_topic_options.rs b/crates/gitea-client/src/models/repo_topic_options.rs index dcef3bf..7cae0af 100644 --- a/crates/gitea-client/src/models/repo_topic_options.rs +++ b/crates/gitea-client/src/models/repo_topic_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/repo_transfer.rs b/crates/gitea-client/src/models/repo_transfer.rs index d61324f..5a344d3 100644 --- a/crates/gitea-client/src/models/repo_transfer.rs +++ b/crates/gitea-client/src/models/repo_transfer.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/repository.rs b/crates/gitea-client/src/models/repository.rs index fb2b641..287a92c 100644 --- a/crates/gitea-client/src/models/repository.rs +++ b/crates/gitea-client/src/models/repository.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,6 +16,8 @@ use serde::{Deserialize, Serialize}; pub struct Repository { #[serde(rename = "allow_fast_forward_only_merge", skip_serializing_if = "Option::is_none")] pub allow_fast_forward_only_merge: Option, + #[serde(rename = "allow_manual_merge", skip_serializing_if = "Option::is_none")] + pub allow_manual_merge: Option, #[serde(rename = "allow_merge_commits", skip_serializing_if = "Option::is_none")] pub allow_merge_commits: Option, #[serde(rename = "allow_rebase", skip_serializing_if = "Option::is_none")] @@ -30,6 +32,8 @@ pub struct Repository { pub archived: Option, #[serde(rename = "archived_at", skip_serializing_if = "Option::is_none")] pub archived_at: Option, + #[serde(rename = "autodetect_manual_merge", skip_serializing_if = "Option::is_none")] + pub autodetect_manual_merge: Option, #[serde(rename = "avatar_url", skip_serializing_if = "Option::is_none")] pub avatar_url: Option, #[serde(rename = "clone_url", skip_serializing_if = "Option::is_none")] @@ -60,6 +64,8 @@ pub struct Repository { pub full_name: Option, #[serde(rename = "has_actions", skip_serializing_if = "Option::is_none")] pub has_actions: Option, + #[serde(rename = "has_code", skip_serializing_if = "Option::is_none")] + pub has_code: Option, #[serde(rename = "has_issues", skip_serializing_if = "Option::is_none")] pub has_issues: Option, #[serde(rename = "has_packages", skip_serializing_if = "Option::is_none")] @@ -86,6 +92,8 @@ pub struct Repository { pub language: Option, #[serde(rename = "languages_url", skip_serializing_if = "Option::is_none")] pub languages_url: Option, + #[serde(rename = "licenses", skip_serializing_if = "Option::is_none")] + pub licenses: Option>, #[serde(rename = "link", skip_serializing_if = "Option::is_none")] pub link: Option, #[serde(rename = "mirror", skip_serializing_if = "Option::is_none")] @@ -127,6 +135,8 @@ pub struct Repository { pub stars_count: Option, #[serde(rename = "template", skip_serializing_if = "Option::is_none")] pub template: Option, + #[serde(rename = "topics", skip_serializing_if = "Option::is_none")] + pub topics: Option>, #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] pub updated_at: Option, #[serde(rename = "url", skip_serializing_if = "Option::is_none")] @@ -142,6 +152,7 @@ impl Repository { pub fn new() -> Repository { Repository { allow_fast_forward_only_merge: None, + allow_manual_merge: None, allow_merge_commits: None, allow_rebase: None, allow_rebase_explicit: None, @@ -149,6 +160,7 @@ impl Repository { allow_squash_merge: None, archived: None, archived_at: None, + autodetect_manual_merge: None, avatar_url: None, clone_url: None, created_at: None, @@ -164,6 +176,7 @@ impl Repository { forks_count: None, full_name: None, has_actions: None, + has_code: None, has_issues: None, has_packages: None, has_projects: None, @@ -177,6 +190,7 @@ impl Repository { internal_tracker: None, language: None, languages_url: None, + licenses: None, link: None, mirror: None, mirror_interval: None, @@ -197,6 +211,7 @@ impl Repository { ssh_url: None, stars_count: None, template: None, + topics: None, updated_at: None, url: None, watchers_count: None, diff --git a/crates/gitea-client/src/models/repository_meta.rs b/crates/gitea-client/src/models/repository_meta.rs index 654dc1d..fa06cf9 100644 --- a/crates/gitea-client/src/models/repository_meta.rs +++ b/crates/gitea-client/src/models/repository_meta.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/search_results.rs b/crates/gitea-client/src/models/search_results.rs index 35bb94b..dbdb179 100644 --- a/crates/gitea-client/src/models/search_results.rs +++ b/crates/gitea-client/src/models/search_results.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,8 +14,10 @@ use serde::{Deserialize, Serialize}; /// SearchResults : SearchResults results of a successful search #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct SearchResults { + /// Data contains the repository search results #[serde(rename = "data", skip_serializing_if = "Option::is_none")] pub data: Option>, + /// OK indicates if the search was successful #[serde(rename = "ok", skip_serializing_if = "Option::is_none")] pub ok: Option, } diff --git a/crates/gitea-client/src/models/secret.rs b/crates/gitea-client/src/models/secret.rs index 286db26..1b00e9d 100644 --- a/crates/gitea-client/src/models/secret.rs +++ b/crates/gitea-client/src/models/secret.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,6 +16,9 @@ use serde::{Deserialize, Serialize}; pub struct Secret { #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, + /// the secret's description + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, /// the secret's name #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, @@ -26,6 +29,7 @@ impl Secret { pub fn new() -> Secret { Secret { created_at: None, + description: None, name: None, } } diff --git a/crates/gitea-client/src/models/server_version.rs b/crates/gitea-client/src/models/server_version.rs index 87f2bb6..1e10cea 100644 --- a/crates/gitea-client/src/models/server_version.rs +++ b/crates/gitea-client/src/models/server_version.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize}; /// ServerVersion : ServerVersion wraps the version of the server #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ServerVersion { + /// Version is the server version string #[serde(rename = "version", skip_serializing_if = "Option::is_none")] pub version: Option, } diff --git a/crates/gitea-client/src/models/stop_watch.rs b/crates/gitea-client/src/models/stop_watch.rs index 5f164b9..61190b6 100644 --- a/crates/gitea-client/src/models/stop_watch.rs +++ b/crates/gitea-client/src/models/stop_watch.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,16 +16,22 @@ use serde::{Deserialize, Serialize}; pub struct StopWatch { #[serde(rename = "created", skip_serializing_if = "Option::is_none")] pub created: Option, + /// Duration is a human-readable duration string #[serde(rename = "duration", skip_serializing_if = "Option::is_none")] pub duration: Option, + /// IssueIndex is the index number of the associated issue #[serde(rename = "issue_index", skip_serializing_if = "Option::is_none")] pub issue_index: Option, + /// IssueTitle is the title of the associated issue #[serde(rename = "issue_title", skip_serializing_if = "Option::is_none")] pub issue_title: Option, + /// RepoName is the name of the repository #[serde(rename = "repo_name", skip_serializing_if = "Option::is_none")] pub repo_name: Option, + /// RepoOwnerName is the name of the repository owner #[serde(rename = "repo_owner_name", skip_serializing_if = "Option::is_none")] pub repo_owner_name: Option, + /// Seconds is the total elapsed time in seconds #[serde(rename = "seconds", skip_serializing_if = "Option::is_none")] pub seconds: Option, } diff --git a/crates/gitea-client/src/models/submit_pull_review_options.rs b/crates/gitea-client/src/models/submit_pull_review_options.rs index 0c011a5..a586fd8 100644 --- a/crates/gitea-client/src/models/submit_pull_review_options.rs +++ b/crates/gitea-client/src/models/submit_pull_review_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/tag.rs b/crates/gitea-client/src/models/tag.rs index fd08b99..01334b0 100644 --- a/crates/gitea-client/src/models/tag.rs +++ b/crates/gitea-client/src/models/tag.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,14 +16,19 @@ use serde::{Deserialize, Serialize}; pub struct Tag { #[serde(rename = "commit", skip_serializing_if = "Option::is_none")] pub commit: Option>, + /// The ID (SHA) of the tag #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// The message associated with the tag #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, + /// The name of the tag #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, + /// The URL to download the tarball archive #[serde(rename = "tarball_url", skip_serializing_if = "Option::is_none")] pub tarball_url: Option, + /// The URL to download the zipball archive #[serde(rename = "zipball_url", skip_serializing_if = "Option::is_none")] pub zipball_url: Option, } diff --git a/crates/gitea-client/src/models/tag_protection.rs b/crates/gitea-client/src/models/tag_protection.rs new file mode 100644 index 0000000..a6ccd6f --- /dev/null +++ b/crates/gitea-client/src/models/tag_protection.rs @@ -0,0 +1,48 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// TagProtection : TagProtection represents a tag protection +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TagProtection { + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// The unique identifier of the tag protection + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// The pattern to match tag names for protection + #[serde(rename = "name_pattern", skip_serializing_if = "Option::is_none")] + pub name_pattern: Option, + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + /// List of team names allowed to create/delete protected tags + #[serde(rename = "whitelist_teams", skip_serializing_if = "Option::is_none")] + pub whitelist_teams: Option>, + /// List of usernames allowed to create/delete protected tags + #[serde(rename = "whitelist_usernames", skip_serializing_if = "Option::is_none")] + pub whitelist_usernames: Option>, +} + +impl TagProtection { + /// TagProtection represents a tag protection + pub fn new() -> TagProtection { + TagProtection { + created_at: None, + id: None, + name_pattern: None, + updated_at: None, + whitelist_teams: None, + whitelist_usernames: None, + } + } +} + diff --git a/crates/gitea-client/src/models/team.rs b/crates/gitea-client/src/models/team.rs index 0b72dfc..8d8c9d7 100644 --- a/crates/gitea-client/src/models/team.rs +++ b/crates/gitea-client/src/models/team.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,14 +14,19 @@ use serde::{Deserialize, Serialize}; /// Team : Team represents a team in an organization #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Team { + /// Whether the team can create repositories in the organization #[serde(rename = "can_create_org_repo", skip_serializing_if = "Option::is_none")] pub can_create_org_repo: Option, + /// The description of the team #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, + /// The unique identifier of the team #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// Whether the team has access to all repositories in the organization #[serde(rename = "includes_all_repositories", skip_serializing_if = "Option::is_none")] pub includes_all_repositories: Option, + /// The name of the team #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, #[serde(rename = "organization", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/team_search_200_response.rs b/crates/gitea-client/src/models/team_search_200_response.rs index 119c135..b278a21 100644 --- a/crates/gitea-client/src/models/team_search_200_response.rs +++ b/crates/gitea-client/src/models/team_search_200_response.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/timeline_comment.rs b/crates/gitea-client/src/models/timeline_comment.rs index 1724f07..a2428b2 100644 --- a/crates/gitea-client/src/models/timeline_comment.rs +++ b/crates/gitea-client/src/models/timeline_comment.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -18,16 +18,20 @@ pub struct TimelineComment { pub assignee: Option>, #[serde(rename = "assignee_team", skip_serializing_if = "Option::is_none")] pub assignee_team: Option>, + /// Body contains the timeline event content #[serde(rename = "body", skip_serializing_if = "Option::is_none")] pub body: Option, #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, #[serde(rename = "dependent_issue", skip_serializing_if = "Option::is_none")] pub dependent_issue: Option>, + /// HTMLURL is the web URL for viewing the comment #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] pub html_url: Option, + /// ID is the unique identifier for the timeline comment #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// IssueURL is the API URL for the issue #[serde(rename = "issue_url", skip_serializing_if = "Option::is_none")] pub issue_url: Option, #[serde(rename = "label", skip_serializing_if = "Option::is_none")] @@ -48,6 +52,7 @@ pub struct TimelineComment { pub old_title: Option, #[serde(rename = "project_id", skip_serializing_if = "Option::is_none")] pub project_id: Option, + /// PRURL is the API URL for the pull request (if applicable) #[serde(rename = "pull_request_url", skip_serializing_if = "Option::is_none")] pub pull_request_url: Option, #[serde(rename = "ref_action", skip_serializing_if = "Option::is_none")] @@ -68,6 +73,7 @@ pub struct TimelineComment { pub review_id: Option, #[serde(rename = "tracked_time", skip_serializing_if = "Option::is_none")] pub tracked_time: Option>, + /// Type indicates the type of timeline event #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub r#type: Option, #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] diff --git a/crates/gitea-client/src/models/topic_name.rs b/crates/gitea-client/src/models/topic_name.rs index 86e22e8..31ac1c9 100644 --- a/crates/gitea-client/src/models/topic_name.rs +++ b/crates/gitea-client/src/models/topic_name.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize}; /// TopicName : TopicName a list of repo topic names #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct TopicName { + /// List of topic names #[serde(rename = "topics", skip_serializing_if = "Option::is_none")] pub topics: Option>, } diff --git a/crates/gitea-client/src/models/topic_response.rs b/crates/gitea-client/src/models/topic_response.rs index 2d185af..0341f99 100644 --- a/crates/gitea-client/src/models/topic_response.rs +++ b/crates/gitea-client/src/models/topic_response.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,14 +14,19 @@ use serde::{Deserialize, Serialize}; /// TopicResponse : TopicResponse for returning topics #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct TopicResponse { + /// The date and time when the topic was created #[serde(rename = "created", skip_serializing_if = "Option::is_none")] pub created: Option, + /// The unique identifier of the topic #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, + /// The number of repositories using this topic #[serde(rename = "repo_count", skip_serializing_if = "Option::is_none")] pub repo_count: Option, + /// The name of the topic #[serde(rename = "topic_name", skip_serializing_if = "Option::is_none")] pub topic_name: Option, + /// The date and time when the topic was last updated #[serde(rename = "updated", skip_serializing_if = "Option::is_none")] pub updated: Option, } diff --git a/crates/gitea-client/src/models/tracked_time.rs b/crates/gitea-client/src/models/tracked_time.rs index 1ef8715..e0c1dd0 100644 --- a/crates/gitea-client/src/models/tracked_time.rs +++ b/crates/gitea-client/src/models/tracked_time.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -16,6 +16,7 @@ use serde::{Deserialize, Serialize}; pub struct TrackedTime { #[serde(rename = "created", skip_serializing_if = "Option::is_none")] pub created: Option, + /// ID is the unique identifier for the tracked time entry #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, #[serde(rename = "issue", skip_serializing_if = "Option::is_none")] @@ -29,6 +30,7 @@ pub struct TrackedTime { /// deprecated (only for backwards compatibility) #[serde(rename = "user_id", skip_serializing_if = "Option::is_none")] pub user_id: Option, + /// username of the user #[serde(rename = "user_name", skip_serializing_if = "Option::is_none")] pub user_name: Option, } diff --git a/crates/gitea-client/src/models/transfer_repo_option.rs b/crates/gitea-client/src/models/transfer_repo_option.rs index c07fd3c..a358223 100644 --- a/crates/gitea-client/src/models/transfer_repo_option.rs +++ b/crates/gitea-client/src/models/transfer_repo_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/update_branch_protection_priories.rs b/crates/gitea-client/src/models/update_branch_protection_priories.rs new file mode 100644 index 0000000..130ac08 --- /dev/null +++ b/crates/gitea-client/src/models/update_branch_protection_priories.rs @@ -0,0 +1,29 @@ +/* + * Gitea API + * + * This documentation describes the Gitea API. + * + * The version of the OpenAPI document: 1.25.2 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// UpdateBranchProtectionPriories : UpdateBranchProtectionPriories a list to update the branch protection rule priorities +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateBranchProtectionPriories { + #[serde(rename = "ids", skip_serializing_if = "Option::is_none")] + pub ids: Option>, +} + +impl UpdateBranchProtectionPriories { + /// UpdateBranchProtectionPriories a list to update the branch protection rule priorities + pub fn new() -> UpdateBranchProtectionPriories { + UpdateBranchProtectionPriories { + ids: None, + } + } +} + diff --git a/crates/gitea-client/src/models/update_file_options.rs b/crates/gitea-client/src/models/update_file_options.rs index 1c20952..7d915f4 100644 --- a/crates/gitea-client/src/models/update_file_options.rs +++ b/crates/gitea-client/src/models/update_file_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -35,7 +35,7 @@ pub struct UpdateFileOptions { /// new_branch (optional) will make a new branch from `branch` before creating the file #[serde(rename = "new_branch", skip_serializing_if = "Option::is_none")] pub new_branch: Option, - /// sha is the SHA for the file that already exists + /// the blob ID (SHA) for the file that already exists, it is required for changing existing files #[serde(rename = "sha")] pub sha: String, /// Add a Signed-off-by trailer by the committer at the end of the commit log message. diff --git a/crates/gitea-client/src/models/update_repo_avatar_option.rs b/crates/gitea-client/src/models/update_repo_avatar_option.rs index c0976b9..852335d 100644 --- a/crates/gitea-client/src/models/update_repo_avatar_option.rs +++ b/crates/gitea-client/src/models/update_repo_avatar_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/update_user_avatar_option.rs b/crates/gitea-client/src/models/update_user_avatar_option.rs index a04c76f..1768786 100644 --- a/crates/gitea-client/src/models/update_user_avatar_option.rs +++ b/crates/gitea-client/src/models/update_user_avatar_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/update_variable_option.rs b/crates/gitea-client/src/models/update_variable_option.rs index d815afe..1126c36 100644 --- a/crates/gitea-client/src/models/update_variable_option.rs +++ b/crates/gitea-client/src/models/update_variable_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,6 +14,9 @@ use serde::{Deserialize, Serialize}; /// UpdateVariableOption : UpdateVariableOption the option when updating variable #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UpdateVariableOption { + /// Description of the variable to update + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, /// New name for the variable. If the field is empty, the variable name won't be updated. #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, @@ -26,6 +29,7 @@ impl UpdateVariableOption { /// UpdateVariableOption the option when updating variable pub fn new(value: String) -> UpdateVariableOption { UpdateVariableOption { + description: None, name: None, value, } diff --git a/crates/gitea-client/src/models/user.rs b/crates/gitea-client/src/models/user.rs index f5f7fab..c6e0371 100644 --- a/crates/gitea-client/src/models/user.rs +++ b/crates/gitea-client/src/models/user.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -52,10 +52,10 @@ pub struct User { /// the user's location #[serde(rename = "location", skip_serializing_if = "Option::is_none")] pub location: Option, - /// the user's username + /// login of the user, same as `username` #[serde(rename = "login", skip_serializing_if = "Option::is_none")] pub login: Option, - /// the user's authentication sign-in name. + /// identifier of the user, provided by the external authenticator (if configured) #[serde(rename = "login_name", skip_serializing_if = "Option::is_none")] pub login_name: Option, /// Is user login prohibited diff --git a/crates/gitea-client/src/models/user_badge_option.rs b/crates/gitea-client/src/models/user_badge_option.rs index c578549..f488a8b 100644 --- a/crates/gitea-client/src/models/user_badge_option.rs +++ b/crates/gitea-client/src/models/user_badge_option.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/user_heatmap_data.rs b/crates/gitea-client/src/models/user_heatmap_data.rs index bbba06a..7f59ae4 100644 --- a/crates/gitea-client/src/models/user_heatmap_data.rs +++ b/crates/gitea-client/src/models/user_heatmap_data.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/user_search_200_response.rs b/crates/gitea-client/src/models/user_search_200_response.rs index 4135a5f..d39e1c2 100644 --- a/crates/gitea-client/src/models/user_search_200_response.rs +++ b/crates/gitea-client/src/models/user_search_200_response.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/user_settings.rs b/crates/gitea-client/src/models/user_settings.rs index f361d9b..735a407 100644 --- a/crates/gitea-client/src/models/user_settings.rs +++ b/crates/gitea-client/src/models/user_settings.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/user_settings_options.rs b/crates/gitea-client/src/models/user_settings_options.rs index 0f01173..90102c9 100644 --- a/crates/gitea-client/src/models/user_settings_options.rs +++ b/crates/gitea-client/src/models/user_settings_options.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ diff --git a/crates/gitea-client/src/models/watch_info.rs b/crates/gitea-client/src/models/watch_info.rs index ec599f0..12eecc2 100644 --- a/crates/gitea-client/src/models/watch_info.rs +++ b/crates/gitea-client/src/models/watch_info.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,16 +14,22 @@ use serde::{Deserialize, Serialize}; /// WatchInfo : WatchInfo represents an API watch status of one repository #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct WatchInfo { + /// The timestamp when the watch status was created #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, + /// Whether notifications for the repository are ignored #[serde(rename = "ignored", skip_serializing_if = "Option::is_none")] pub ignored: Option, + /// The reason for the current watch status #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option, + /// The URL of the repository being watched #[serde(rename = "repository_url", skip_serializing_if = "Option::is_none")] pub repository_url: Option, + /// Whether the repository is being watched for notifications #[serde(rename = "subscribed", skip_serializing_if = "Option::is_none")] pub subscribed: Option, + /// The URL for managing the watch status #[serde(rename = "url", skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/crates/gitea-client/src/models/wiki_commit.rs b/crates/gitea-client/src/models/wiki_commit.rs index 74b3a4e..9c580ae 100644 --- a/crates/gitea-client/src/models/wiki_commit.rs +++ b/crates/gitea-client/src/models/wiki_commit.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -18,8 +18,10 @@ pub struct WikiCommit { pub author: Option>, #[serde(rename = "commiter", skip_serializing_if = "Option::is_none")] pub commiter: Option>, + /// The commit message #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, + /// The commit SHA hash #[serde(rename = "sha", skip_serializing_if = "Option::is_none")] pub sha: Option, } diff --git a/crates/gitea-client/src/models/wiki_commit_list.rs b/crates/gitea-client/src/models/wiki_commit_list.rs index fd0f32f..fa847ba 100644 --- a/crates/gitea-client/src/models/wiki_commit_list.rs +++ b/crates/gitea-client/src/models/wiki_commit_list.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,8 +14,10 @@ use serde::{Deserialize, Serialize}; /// WikiCommitList : WikiCommitList commit/revision list #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct WikiCommitList { + /// The list of wiki commits #[serde(rename = "commits", skip_serializing_if = "Option::is_none")] pub commits: Option>, + /// The total count of commits #[serde(rename = "count", skip_serializing_if = "Option::is_none")] pub count: Option, } diff --git a/crates/gitea-client/src/models/wiki_page.rs b/crates/gitea-client/src/models/wiki_page.rs index 6a90379..eff44f5 100644 --- a/crates/gitea-client/src/models/wiki_page.rs +++ b/crates/gitea-client/src/models/wiki_page.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,21 +14,27 @@ use serde::{Deserialize, Serialize}; /// WikiPage : WikiPage a wiki page #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct WikiPage { + /// The number of commits that modified this page #[serde(rename = "commit_count", skip_serializing_if = "Option::is_none")] pub commit_count: Option, /// Page content, base64 encoded #[serde(rename = "content_base64", skip_serializing_if = "Option::is_none")] pub content_base64: Option, + /// The footer content for the wiki page #[serde(rename = "footer", skip_serializing_if = "Option::is_none")] pub footer: Option, + /// The HTML URL to view the wiki page #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] pub html_url: Option, #[serde(rename = "last_commit", skip_serializing_if = "Option::is_none")] pub last_commit: Option>, + /// The sidebar content for the wiki page #[serde(rename = "sidebar", skip_serializing_if = "Option::is_none")] pub sidebar: Option, + /// The sub URL path for the wiki page #[serde(rename = "sub_url", skip_serializing_if = "Option::is_none")] pub sub_url: Option, + /// The title of the wiki page #[serde(rename = "title", skip_serializing_if = "Option::is_none")] pub title: Option, } diff --git a/crates/gitea-client/src/models/wiki_page_meta_data.rs b/crates/gitea-client/src/models/wiki_page_meta_data.rs index db17332..eee31e5 100644 --- a/crates/gitea-client/src/models/wiki_page_meta_data.rs +++ b/crates/gitea-client/src/models/wiki_page_meta_data.rs @@ -3,7 +3,7 @@ * * This documentation describes the Gitea API. * - * The version of the OpenAPI document: 1.22.1 + * The version of the OpenAPI document: 1.25.2 * * Generated by: https://openapi-generator.tech */ @@ -14,12 +14,15 @@ use serde::{Deserialize, Serialize}; /// WikiPageMetaData : WikiPageMetaData wiki page meta information #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct WikiPageMetaData { + /// The HTML URL to view the wiki page #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")] pub html_url: Option, #[serde(rename = "last_commit", skip_serializing_if = "Option::is_none")] pub last_commit: Option>, + /// The sub URL path for the wiki page #[serde(rename = "sub_url", skip_serializing_if = "Option::is_none")] pub sub_url: Option, + /// The title of the wiki page #[serde(rename = "title", skip_serializing_if = "Option::is_none")] pub title: Option, }