forgejo 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/LICENSE +9 -0
- data/LICENSE~ +9 -0
- data/Makefile +23 -0
- data/Makefile~ +2 -0
- data/README.md +717 -0
- data/Rakefile +10 -0
- data/docs/APIError.md +20 -0
- data/docs/AccessToken.md +26 -0
- data/docs/ActionTask.md +42 -0
- data/docs/ActionTaskResponse.md +20 -0
- data/docs/ActionVariable.md +24 -0
- data/docs/Activity.md +42 -0
- data/docs/ActivityPub.md +18 -0
- data/docs/ActivitypubApi.md +289 -0
- data/docs/AddCollaboratorOption.md +18 -0
- data/docs/AddTimeOption.md +22 -0
- data/docs/AdminApi.md +1672 -0
- data/docs/AnnotatedTag.md +32 -0
- data/docs/AnnotatedTagObject.md +22 -0
- data/docs/Attachment.md +30 -0
- data/docs/BlockedUser.md +20 -0
- data/docs/Branch.md +34 -0
- data/docs/BranchProtection.md +70 -0
- data/docs/ChangeFileOperation.md +26 -0
- data/docs/ChangeFilesOptions.md +32 -0
- data/docs/ChangedFile.md +34 -0
- data/docs/CombinedStatus.md +30 -0
- data/docs/Comment.md +38 -0
- data/docs/Commit.md +36 -0
- data/docs/CommitAffectedFiles.md +20 -0
- data/docs/CommitDateOptions.md +20 -0
- data/docs/CommitMeta.md +22 -0
- data/docs/CommitStats.md +22 -0
- data/docs/CommitStatus.md +34 -0
- data/docs/CommitUser.md +22 -0
- data/docs/Compare.md +20 -0
- data/docs/ContentsResponse.md +46 -0
- data/docs/CreateAccessTokenOption.md +20 -0
- data/docs/CreateBranchProtectionOption.md +66 -0
- data/docs/CreateBranchRepoOption.md +22 -0
- data/docs/CreateEmailOption.md +18 -0
- data/docs/CreateFileOptions.md +32 -0
- data/docs/CreateForkOption.md +20 -0
- data/docs/CreateGPGKeyOption.md +20 -0
- data/docs/CreateHookOption.md +28 -0
- data/docs/CreateIssueCommentOption.md +20 -0
- data/docs/CreateIssueOption.md +34 -0
- data/docs/CreateKeyOption.md +22 -0
- data/docs/CreateLabelOption.md +26 -0
- data/docs/CreateMilestoneOption.md +24 -0
- data/docs/CreateOAuth2ApplicationOptions.md +22 -0
- data/docs/CreateOrUpdateSecretOption.md +18 -0
- data/docs/CreateOrgOption.md +32 -0
- data/docs/CreatePullRequestOption.md +34 -0
- data/docs/CreatePullReviewComment.md +24 -0
- data/docs/CreatePullReviewOptions.md +24 -0
- data/docs/CreatePushMirrorOption.md +26 -0
- data/docs/CreateReleaseOption.md +30 -0
- data/docs/CreateRepoOption.md +40 -0
- data/docs/CreateStatusOption.md +24 -0
- data/docs/CreateTagOption.md +22 -0
- data/docs/CreateTagProtectionOption.md +22 -0
- data/docs/CreateTeamOption.md +30 -0
- data/docs/CreateUserOption.md +38 -0
- data/docs/CreateVariableOption.md +18 -0
- data/docs/CreateWikiPageOptions.md +22 -0
- data/docs/Cron.md +26 -0
- data/docs/DeleteEmailOption.md +18 -0
- data/docs/DeleteFileOptions.md +32 -0
- data/docs/DeleteLabelsOption.md +18 -0
- data/docs/DeployKey.md +34 -0
- data/docs/DismissPullReviewOptions.md +20 -0
- data/docs/DispatchWorkflowOption.md +20 -0
- data/docs/EditAttachmentOptions.md +18 -0
- data/docs/EditBranchProtectionOption.md +62 -0
- data/docs/EditDeadlineOption.md +18 -0
- data/docs/EditGitHookOption.md +18 -0
- data/docs/EditHookOption.md +26 -0
- data/docs/EditIssueCommentOption.md +20 -0
- data/docs/EditIssueOption.md +36 -0
- data/docs/EditLabelOption.md +26 -0
- data/docs/EditMilestoneOption.md +24 -0
- data/docs/EditOrgOption.md +30 -0
- data/docs/EditPullRequestOption.md +38 -0
- data/docs/EditReactionOption.md +18 -0
- data/docs/EditReleaseOption.md +30 -0
- data/docs/EditRepoOption.md +82 -0
- data/docs/EditTagProtectionOption.md +22 -0
- data/docs/EditTeamOption.md +30 -0
- data/docs/EditUserOption.md +54 -0
- data/docs/Email.md +26 -0
- data/docs/ExternalTracker.md +24 -0
- data/docs/ExternalWiki.md +18 -0
- data/docs/FileCommitResponse.md +34 -0
- data/docs/FileDeleteResponse.md +22 -0
- data/docs/FileLinksResponse.md +22 -0
- data/docs/FileResponse.md +22 -0
- data/docs/FilesResponse.md +22 -0
- data/docs/GPGKey.md +42 -0
- data/docs/GPGKeyEmail.md +20 -0
- data/docs/GeneralAPISettings.md +24 -0
- data/docs/GeneralAttachmentSettings.md +24 -0
- data/docs/GeneralRepoSettings.md +30 -0
- data/docs/GeneralUISettings.md +22 -0
- data/docs/GenerateRepoOption.md +40 -0
- data/docs/GitBlobResponse.md +26 -0
- data/docs/GitEntry.md +28 -0
- data/docs/GitHook.md +22 -0
- data/docs/GitObject.md +22 -0
- data/docs/GitTreeResponse.md +28 -0
- data/docs/GitignoreTemplateInfo.md +20 -0
- data/docs/Hook.md +40 -0
- data/docs/Identity.md +20 -0
- data/docs/InternalTracker.md +22 -0
- data/docs/Issue.md +66 -0
- data/docs/IssueApi.md +5206 -0
- data/docs/IssueConfig.md +20 -0
- data/docs/IssueConfigContactLink.md +22 -0
- data/docs/IssueConfigValidation.md +20 -0
- data/docs/IssueDeadline.md +18 -0
- data/docs/IssueFormField.md +26 -0
- data/docs/IssueLabelsOption.md +20 -0
- data/docs/IssueMeta.md +22 -0
- data/docs/IssueTemplate.md +32 -0
- data/docs/Label.md +30 -0
- data/docs/LabelTemplate.md +24 -0
- data/docs/LicenseTemplateInfo.md +26 -0
- data/docs/LicensesTemplateListEntry.md +22 -0
- data/docs/MarkdownOption.md +24 -0
- data/docs/MarkupOption.md +26 -0
- data/docs/MergePullRequestOption.md +32 -0
- data/docs/MigrateRepoOptions.md +56 -0
- data/docs/Milestone.md +36 -0
- data/docs/MiscellaneousApi.md +833 -0
- data/docs/NewIssuePinsAllowed.md +20 -0
- data/docs/NodeInfo.md +30 -0
- data/docs/NodeInfoServices.md +20 -0
- data/docs/NodeInfoSoftware.md +24 -0
- data/docs/NodeInfoUsage.md +22 -0
- data/docs/NodeInfoUsageUsers.md +22 -0
- data/docs/Note.md +20 -0
- data/docs/NotificationApi.md +550 -0
- data/docs/NotificationCount.md +18 -0
- data/docs/NotificationSubject.md +30 -0
- data/docs/NotificationThread.md +30 -0
- data/docs/OAuth2Application.md +30 -0
- data/docs/Organization.md +38 -0
- data/docs/OrganizationApi.md +4259 -0
- data/docs/OrganizationPermissions.md +26 -0
- data/docs/PRBranchInfo.md +26 -0
- data/docs/Package.md +34 -0
- data/docs/PackageApi.md +314 -0
- data/docs/PackageFile.md +30 -0
- data/docs/PayloadCommit.md +36 -0
- data/docs/PayloadCommitVerification.md +26 -0
- data/docs/PayloadUser.md +22 -0
- data/docs/Permission.md +22 -0
- data/docs/PublicKey.md +34 -0
- data/docs/PullRequest.md +88 -0
- data/docs/PullRequestMeta.md +24 -0
- data/docs/PullReview.md +44 -0
- data/docs/PullReviewComment.md +46 -0
- data/docs/PullReviewRequestOptions.md +20 -0
- data/docs/PushMirror.md +32 -0
- data/docs/Reaction.md +22 -0
- data/docs/Reference.md +22 -0
- data/docs/Release.md +52 -0
- data/docs/RenameUserOption.md +18 -0
- data/docs/ReplaceFlagsOption.md +18 -0
- data/docs/RepoCollaboratorPermission.md +22 -0
- data/docs/RepoCommit.md +28 -0
- data/docs/RepoCreateReleaseAttachmentRequest.md +18 -0
- data/docs/RepoTopicOptions.md +18 -0
- data/docs/RepoTransfer.md +22 -0
- data/docs/Repository.md +140 -0
- data/docs/RepositoryApi.md +13022 -0
- data/docs/RepositoryMeta.md +24 -0
- data/docs/SearchResults.md +20 -0
- data/docs/Secret.md +20 -0
- data/docs/ServerVersion.md +18 -0
- data/docs/SettingsApi.md +275 -0
- data/docs/StopWatch.md +30 -0
- data/docs/SubmitPullReviewOptions.md +20 -0
- data/docs/Tag.md +30 -0
- data/docs/TagArchiveDownloadCount.md +20 -0
- data/docs/TagProtection.md +28 -0
- data/docs/Team.md +34 -0
- data/docs/TeamSearch200Response.md +20 -0
- data/docs/TimelineComment.md +74 -0
- data/docs/TopicName.md +18 -0
- data/docs/TopicResponse.md +26 -0
- data/docs/TrackedTime.md +30 -0
- data/docs/TransferRepoOption.md +20 -0
- data/docs/UpdateFileOptions.md +36 -0
- data/docs/UpdateRepoAvatarOption.md +18 -0
- data/docs/UpdateUserAvatarOption.md +18 -0
- data/docs/UpdateVariableOption.md +20 -0
- data/docs/User.md +62 -0
- data/docs/UserApi.md +4969 -0
- data/docs/UserHeatmapData.md +20 -0
- data/docs/UserSearch200Response.md +20 -0
- data/docs/UserSettings.md +38 -0
- data/docs/UserSettingsOptions.md +38 -0
- data/docs/WatchInfo.md +28 -0
- data/docs/WikiCommit.md +24 -0
- data/docs/WikiCommitList.md +20 -0
- data/docs/WikiPage.md +32 -0
- data/docs/WikiPageMetaData.md +24 -0
- data/forgejo.gemspec +49 -0
- data/git_push.sh +57 -0
- data/lib/forgejo/api/activitypub_api.rb +269 -0
- data/lib/forgejo/api/admin_api.rb +1496 -0
- data/lib/forgejo/api/issue_api.rb +5282 -0
- data/lib/forgejo/api/miscellaneous_api.rb +725 -0
- data/lib/forgejo/api/notification_api.rb +520 -0
- data/lib/forgejo/api/organization_api.rb +3898 -0
- data/lib/forgejo/api/package_api.rb +334 -0
- data/lib/forgejo/api/repository_api.rb +12849 -0
- data/lib/forgejo/api/settings_api.rb +242 -0
- data/lib/forgejo/api/user_api.rb +4314 -0
- data/lib/forgejo/api_client.rb +437 -0
- data/lib/forgejo/api_error.rb +58 -0
- data/lib/forgejo/configuration.rb +392 -0
- data/lib/forgejo/models/access_token.rb +252 -0
- data/lib/forgejo/models/action_task.rb +323 -0
- data/lib/forgejo/models/action_task_response.rb +226 -0
- data/lib/forgejo/models/action_variable.rb +246 -0
- data/lib/forgejo/models/activity.rb +357 -0
- data/lib/forgejo/models/activity_pub.rb +215 -0
- data/lib/forgejo/models/add_collaborator_option.rb +215 -0
- data/lib/forgejo/models/add_time_option.rb +242 -0
- data/lib/forgejo/models/annotated_tag.rb +278 -0
- data/lib/forgejo/models/annotated_tag_object.rb +233 -0
- data/lib/forgejo/models/api_error.rb +224 -0
- data/lib/forgejo/models/attachment.rb +269 -0
- data/lib/forgejo/models/blocked_user.rb +223 -0
- data/lib/forgejo/models/branch.rb +289 -0
- data/lib/forgejo/models/branch_protection.rb +464 -0
- data/lib/forgejo/models/change_file_operation.rb +304 -0
- data/lib/forgejo/models/change_files_options.rb +292 -0
- data/lib/forgejo/models/changed_file.rb +287 -0
- data/lib/forgejo/models/combined_status.rb +272 -0
- data/lib/forgejo/models/comment.rb +307 -0
- data/lib/forgejo/models/commit.rb +299 -0
- data/lib/forgejo/models/commit_affected_files.rb +224 -0
- data/lib/forgejo/models/commit_date_options.rb +224 -0
- data/lib/forgejo/models/commit_meta.rb +232 -0
- data/lib/forgejo/models/commit_stats.rb +233 -0
- data/lib/forgejo/models/commit_status.rb +288 -0
- data/lib/forgejo/models/commit_user.rb +232 -0
- data/lib/forgejo/models/compare.rb +225 -0
- data/lib/forgejo/models/contents_response.rb +346 -0
- data/lib/forgejo/models/create_access_token_option.rb +233 -0
- data/lib/forgejo/models/create_branch_protection_option.rb +446 -0
- data/lib/forgejo/models/create_branch_repo_option.rb +243 -0
- data/lib/forgejo/models/create_email_option.rb +218 -0
- data/lib/forgejo/models/create_file_options.rb +290 -0
- data/lib/forgejo/models/create_fork_option.rb +226 -0
- data/lib/forgejo/models/create_gpg_key_option.rb +232 -0
- data/lib/forgejo/models/create_hook_option.rb +315 -0
- data/lib/forgejo/models/create_issue_comment_option.rb +231 -0
- data/lib/forgejo/models/create_issue_option.rb +301 -0
- data/lib/forgejo/models/create_key_option.rb +250 -0
- data/lib/forgejo/models/create_label_option.rb +265 -0
- data/lib/forgejo/models/create_milestone_option.rb +276 -0
- data/lib/forgejo/models/create_o_auth2_application_options.rb +235 -0
- data/lib/forgejo/models/create_or_update_secret_option.rb +223 -0
- data/lib/forgejo/models/create_org_option.rb +320 -0
- data/lib/forgejo/models/create_pull_request_option.rb +291 -0
- data/lib/forgejo/models/create_pull_review_comment.rb +245 -0
- data/lib/forgejo/models/create_pull_review_options.rb +245 -0
- data/lib/forgejo/models/create_push_mirror_option.rb +250 -0
- data/lib/forgejo/models/create_release_option.rb +276 -0
- data/lib/forgejo/models/create_repo_option.rb +379 -0
- data/lib/forgejo/models/create_status_option.rb +243 -0
- data/lib/forgejo/models/create_tag_option.rb +240 -0
- data/lib/forgejo/models/create_tag_protection_option.rb +237 -0
- data/lib/forgejo/models/create_team_option.rb +314 -0
- data/lib/forgejo/models/create_user_option.rb +320 -0
- data/lib/forgejo/models/create_variable_option.rb +223 -0
- data/lib/forgejo/models/create_wiki_page_options.rb +236 -0
- data/lib/forgejo/models/cron.rb +251 -0
- data/lib/forgejo/models/delete_email_option.rb +218 -0
- data/lib/forgejo/models/delete_file_options.rb +290 -0
- data/lib/forgejo/models/delete_labels_option.rb +215 -0
- data/lib/forgejo/models/deploy_key.rb +287 -0
- data/lib/forgejo/models/dismiss_pull_review_options.rb +224 -0
- data/lib/forgejo/models/dispatch_workflow_option.rb +235 -0
- data/lib/forgejo/models/edit_attachment_options.rb +215 -0
- data/lib/forgejo/models/edit_branch_protection_option.rb +427 -0
- data/lib/forgejo/models/edit_deadline_option.rb +222 -0
- data/lib/forgejo/models/edit_git_hook_option.rb +215 -0
- data/lib/forgejo/models/edit_hook_option.rb +255 -0
- data/lib/forgejo/models/edit_issue_comment_option.rb +231 -0
- data/lib/forgejo/models/edit_issue_option.rb +299 -0
- data/lib/forgejo/models/edit_label_option.rb +251 -0
- data/lib/forgejo/models/edit_milestone_option.rb +242 -0
- data/lib/forgejo/models/edit_org_option.rb +304 -0
- data/lib/forgejo/models/edit_pull_request_option.rb +309 -0
- data/lib/forgejo/models/edit_reaction_option.rb +215 -0
- data/lib/forgejo/models/edit_release_option.rb +269 -0
- data/lib/forgejo/models/edit_repo_option.rb +533 -0
- data/lib/forgejo/models/edit_tag_protection_option.rb +237 -0
- data/lib/forgejo/models/edit_team_option.rb +314 -0
- data/lib/forgejo/models/edit_user_option.rb +377 -0
- data/lib/forgejo/models/email.rb +251 -0
- data/lib/forgejo/models/external_tracker.rb +246 -0
- data/lib/forgejo/models/external_wiki.rb +216 -0
- data/lib/forgejo/models/file_commit_response.rb +288 -0
- data/lib/forgejo/models/file_delete_response.rb +233 -0
- data/lib/forgejo/models/file_links_response.rb +233 -0
- data/lib/forgejo/models/file_response.rb +233 -0
- data/lib/forgejo/models/files_response.rb +235 -0
- data/lib/forgejo/models/general_api_settings.rb +242 -0
- data/lib/forgejo/models/general_attachment_settings.rb +242 -0
- data/lib/forgejo/models/general_repo_settings.rb +269 -0
- data/lib/forgejo/models/general_ui_settings.rb +237 -0
- data/lib/forgejo/models/generate_repo_option.rb +340 -0
- data/lib/forgejo/models/git_blob_response.rb +251 -0
- data/lib/forgejo/models/git_entry.rb +260 -0
- data/lib/forgejo/models/git_hook.rb +233 -0
- data/lib/forgejo/models/git_object.rb +232 -0
- data/lib/forgejo/models/git_tree_response.rb +262 -0
- data/lib/forgejo/models/gitignore_template_info.rb +224 -0
- data/lib/forgejo/models/gpg_key.rb +327 -0
- data/lib/forgejo/models/gpg_key_email.rb +224 -0
- data/lib/forgejo/models/hook.rb +319 -0
- data/lib/forgejo/models/identity.rb +224 -0
- data/lib/forgejo/models/internal_tracker.rb +236 -0
- data/lib/forgejo/models/issue.rb +438 -0
- data/lib/forgejo/models/issue_config.rb +225 -0
- data/lib/forgejo/models/issue_config_contact_link.rb +232 -0
- data/lib/forgejo/models/issue_config_validation.rb +223 -0
- data/lib/forgejo/models/issue_deadline.rb +215 -0
- data/lib/forgejo/models/issue_form_field.rb +257 -0
- data/lib/forgejo/models/issue_labels_option.rb +227 -0
- data/lib/forgejo/models/issue_meta.rb +233 -0
- data/lib/forgejo/models/issue_template.rb +282 -0
- data/lib/forgejo/models/label.rb +269 -0
- data/lib/forgejo/models/label_template.rb +242 -0
- data/lib/forgejo/models/license_template_info.rb +251 -0
- data/lib/forgejo/models/licenses_template_list_entry.rb +233 -0
- data/lib/forgejo/models/markdown_option.rb +246 -0
- data/lib/forgejo/models/markup_option.rb +256 -0
- data/lib/forgejo/models/merge_pull_request_option.rb +319 -0
- data/lib/forgejo/models/migrate_repo_options.rb +436 -0
- data/lib/forgejo/models/milestone.rb +297 -0
- data/lib/forgejo/models/new_issue_pins_allowed.rb +224 -0
- data/lib/forgejo/models/node_info.rb +271 -0
- data/lib/forgejo/models/node_info_services.rb +228 -0
- data/lib/forgejo/models/node_info_software.rb +242 -0
- data/lib/forgejo/models/node_info_usage.rb +233 -0
- data/lib/forgejo/models/node_info_usage_users.rb +233 -0
- data/lib/forgejo/models/note.rb +224 -0
- data/lib/forgejo/models/notification_count.rb +215 -0
- data/lib/forgejo/models/notification_subject.rb +271 -0
- data/lib/forgejo/models/notification_thread.rb +269 -0
- data/lib/forgejo/models/o_auth2_application.rb +270 -0
- data/lib/forgejo/models/organization.rb +306 -0
- data/lib/forgejo/models/organization_permissions.rb +251 -0
- data/lib/forgejo/models/package.rb +287 -0
- data/lib/forgejo/models/package_file.rb +269 -0
- data/lib/forgejo/models/payload_commit.rb +303 -0
- data/lib/forgejo/models/payload_commit_verification.rb +251 -0
- data/lib/forgejo/models/payload_user.rb +234 -0
- data/lib/forgejo/models/permission.rb +233 -0
- data/lib/forgejo/models/pr_branch_info.rb +251 -0
- data/lib/forgejo/models/public_key.rb +287 -0
- data/lib/forgejo/models/pull_request.rb +538 -0
- data/lib/forgejo/models/pull_request_meta.rb +242 -0
- data/lib/forgejo/models/pull_review.rb +333 -0
- data/lib/forgejo/models/pull_review_comment.rb +341 -0
- data/lib/forgejo/models/pull_review_request_options.rb +228 -0
- data/lib/forgejo/models/push_mirror.rb +278 -0
- data/lib/forgejo/models/reaction.rb +233 -0
- data/lib/forgejo/models/reference.rb +232 -0
- data/lib/forgejo/models/release.rb +370 -0
- data/lib/forgejo/models/rename_user_option.rb +223 -0
- data/lib/forgejo/models/replace_flags_option.rb +217 -0
- data/lib/forgejo/models/repo_collaborator_permission.rb +233 -0
- data/lib/forgejo/models/repo_commit.rb +259 -0
- data/lib/forgejo/models/repo_create_release_attachment_request.rb +215 -0
- data/lib/forgejo/models/repo_topic_options.rb +218 -0
- data/lib/forgejo/models/repo_transfer.rb +235 -0
- data/lib/forgejo/models/repository.rb +801 -0
- data/lib/forgejo/models/repository_meta.rb +242 -0
- data/lib/forgejo/models/search_results.rb +226 -0
- data/lib/forgejo/models/secret.rb +225 -0
- data/lib/forgejo/models/server_version.rb +215 -0
- data/lib/forgejo/models/stop_watch.rb +269 -0
- data/lib/forgejo/models/submit_pull_review_options.rb +225 -0
- data/lib/forgejo/models/tag.rb +269 -0
- data/lib/forgejo/models/tag_archive_download_count.rb +224 -0
- data/lib/forgejo/models/tag_protection.rb +264 -0
- data/lib/forgejo/models/team.rb +325 -0
- data/lib/forgejo/models/team_search200_response.rb +225 -0
- data/lib/forgejo/models/timeline_comment.rb +469 -0
- data/lib/forgejo/models/topic_name.rb +217 -0
- data/lib/forgejo/models/topic_response.rb +251 -0
- data/lib/forgejo/models/tracked_time.rb +272 -0
- data/lib/forgejo/models/transfer_repo_option.rb +234 -0
- data/lib/forgejo/models/update_file_options.rb +317 -0
- data/lib/forgejo/models/update_repo_avatar_option.rb +216 -0
- data/lib/forgejo/models/update_user_avatar_option.rb +216 -0
- data/lib/forgejo/models/update_variable_option.rb +233 -0
- data/lib/forgejo/models/user.rb +433 -0
- data/lib/forgejo/models/user_heatmap_data.rb +225 -0
- data/lib/forgejo/models/user_search200_response.rb +225 -0
- data/lib/forgejo/models/user_settings.rb +306 -0
- data/lib/forgejo/models/user_settings_options.rb +306 -0
- data/lib/forgejo/models/watch_info.rb +260 -0
- data/lib/forgejo/models/wiki_commit.rb +242 -0
- data/lib/forgejo/models/wiki_commit_list.rb +226 -0
- data/lib/forgejo/models/wiki_page.rb +279 -0
- data/lib/forgejo/models/wiki_page_meta_data.rb +242 -0
- data/lib/forgejo/version.rb +15 -0
- data/lib/forgejo.rb +241 -0
- data/manifest.scm +2 -0
- data/patch +7 -0
- data/patch~ +1 -0
- data/smoke +16 -0
- data/smoke~ +1 -0
- data/spec/api/activitypub_api_spec.rb +80 -0
- data/spec/api/admin_api_spec.rb +308 -0
- data/spec/api/issue_api_spec.rb +998 -0
- data/spec/api/miscellaneous_api_spec.rb +161 -0
- data/spec/api/notification_api_spec.rb +134 -0
- data/spec/api/organization_api_spec.rb +752 -0
- data/spec/api/package_api_spec.rb +92 -0
- data/spec/api/repository_api_spec.rb +2366 -0
- data/spec/api/settings_api_spec.rb +75 -0
- data/spec/api/user_api_spec.rb +839 -0
- data/spec/models/access_token_spec.rb +60 -0
- data/spec/models/action_task_response_spec.rb +42 -0
- data/spec/models/action_task_spec.rb +108 -0
- data/spec/models/action_variable_spec.rb +54 -0
- data/spec/models/activity_pub_spec.rb +36 -0
- data/spec/models/activity_spec.rb +112 -0
- data/spec/models/add_collaborator_option_spec.rb +36 -0
- data/spec/models/add_time_option_spec.rb +48 -0
- data/spec/models/annotated_tag_object_spec.rb +48 -0
- data/spec/models/annotated_tag_spec.rb +78 -0
- data/spec/models/api_error_spec.rb +42 -0
- data/spec/models/attachment_spec.rb +72 -0
- data/spec/models/blocked_user_spec.rb +42 -0
- data/spec/models/branch_protection_spec.rb +192 -0
- data/spec/models/branch_spec.rb +84 -0
- data/spec/models/change_file_operation_spec.rb +64 -0
- data/spec/models/change_files_options_spec.rb +78 -0
- data/spec/models/changed_file_spec.rb +84 -0
- data/spec/models/combined_status_spec.rb +72 -0
- data/spec/models/comment_spec.rb +96 -0
- data/spec/models/commit_affected_files_spec.rb +42 -0
- data/spec/models/commit_date_options_spec.rb +42 -0
- data/spec/models/commit_meta_spec.rb +48 -0
- data/spec/models/commit_spec.rb +90 -0
- data/spec/models/commit_stats_spec.rb +48 -0
- data/spec/models/commit_status_spec.rb +84 -0
- data/spec/models/commit_user_spec.rb +48 -0
- data/spec/models/compare_spec.rb +42 -0
- data/spec/models/contents_response_spec.rb +120 -0
- data/spec/models/create_access_token_option_spec.rb +42 -0
- data/spec/models/create_branch_protection_option_spec.rb +180 -0
- data/spec/models/create_branch_repo_option_spec.rb +48 -0
- data/spec/models/create_email_option_spec.rb +36 -0
- data/spec/models/create_file_options_spec.rb +78 -0
- data/spec/models/create_fork_option_spec.rb +42 -0
- data/spec/models/create_gpg_key_option_spec.rb +42 -0
- data/spec/models/create_hook_option_spec.rb +70 -0
- data/spec/models/create_issue_comment_option_spec.rb +42 -0
- data/spec/models/create_issue_option_spec.rb +84 -0
- data/spec/models/create_key_option_spec.rb +48 -0
- data/spec/models/create_label_option_spec.rb +60 -0
- data/spec/models/create_milestone_option_spec.rb +58 -0
- data/spec/models/create_o_auth2_application_options_spec.rb +48 -0
- data/spec/models/create_or_update_secret_option_spec.rb +36 -0
- data/spec/models/create_org_option_spec.rb +82 -0
- data/spec/models/create_pull_request_option_spec.rb +84 -0
- data/spec/models/create_pull_review_comment_spec.rb +54 -0
- data/spec/models/create_pull_review_options_spec.rb +54 -0
- data/spec/models/create_push_mirror_option_spec.rb +60 -0
- data/spec/models/create_release_option_spec.rb +72 -0
- data/spec/models/create_repo_option_spec.rb +110 -0
- data/spec/models/create_status_option_spec.rb +54 -0
- data/spec/models/create_tag_option_spec.rb +48 -0
- data/spec/models/create_tag_protection_option_spec.rb +48 -0
- data/spec/models/create_team_option_spec.rb +76 -0
- data/spec/models/create_user_option_spec.rb +96 -0
- data/spec/models/create_variable_option_spec.rb +36 -0
- data/spec/models/create_wiki_page_options_spec.rb +48 -0
- data/spec/models/cron_spec.rb +60 -0
- data/spec/models/delete_email_option_spec.rb +36 -0
- data/spec/models/delete_file_options_spec.rb +78 -0
- data/spec/models/delete_labels_option_spec.rb +36 -0
- data/spec/models/deploy_key_spec.rb +84 -0
- data/spec/models/dismiss_pull_review_options_spec.rb +42 -0
- data/spec/models/dispatch_workflow_option_spec.rb +42 -0
- data/spec/models/edit_attachment_options_spec.rb +36 -0
- data/spec/models/edit_branch_protection_option_spec.rb +168 -0
- data/spec/models/edit_deadline_option_spec.rb +36 -0
- data/spec/models/edit_git_hook_option_spec.rb +36 -0
- data/spec/models/edit_hook_option_spec.rb +60 -0
- data/spec/models/edit_issue_comment_option_spec.rb +42 -0
- data/spec/models/edit_issue_option_spec.rb +90 -0
- data/spec/models/edit_label_option_spec.rb +60 -0
- data/spec/models/edit_milestone_option_spec.rb +54 -0
- data/spec/models/edit_org_option_spec.rb +76 -0
- data/spec/models/edit_pull_request_option_spec.rb +96 -0
- data/spec/models/edit_reaction_option_spec.rb +36 -0
- data/spec/models/edit_release_option_spec.rb +72 -0
- data/spec/models/edit_repo_option_spec.rb +228 -0
- data/spec/models/edit_tag_protection_option_spec.rb +48 -0
- data/spec/models/edit_team_option_spec.rb +76 -0
- data/spec/models/edit_user_option_spec.rb +144 -0
- data/spec/models/email_spec.rb +60 -0
- data/spec/models/external_tracker_spec.rb +54 -0
- data/spec/models/external_wiki_spec.rb +36 -0
- data/spec/models/file_commit_response_spec.rb +84 -0
- data/spec/models/file_delete_response_spec.rb +48 -0
- data/spec/models/file_links_response_spec.rb +48 -0
- data/spec/models/file_response_spec.rb +48 -0
- data/spec/models/files_response_spec.rb +48 -0
- data/spec/models/general_api_settings_spec.rb +54 -0
- data/spec/models/general_attachment_settings_spec.rb +54 -0
- data/spec/models/general_repo_settings_spec.rb +72 -0
- data/spec/models/general_ui_settings_spec.rb +48 -0
- data/spec/models/generate_repo_option_spec.rb +102 -0
- data/spec/models/git_blob_response_spec.rb +60 -0
- data/spec/models/git_entry_spec.rb +66 -0
- data/spec/models/git_hook_spec.rb +48 -0
- data/spec/models/git_object_spec.rb +48 -0
- data/spec/models/git_tree_response_spec.rb +66 -0
- data/spec/models/gitignore_template_info_spec.rb +42 -0
- data/spec/models/gpg_key_email_spec.rb +42 -0
- data/spec/models/gpg_key_spec.rb +108 -0
- data/spec/models/hook_spec.rb +102 -0
- data/spec/models/identity_spec.rb +42 -0
- data/spec/models/internal_tracker_spec.rb +48 -0
- data/spec/models/issue_config_contact_link_spec.rb +48 -0
- data/spec/models/issue_config_spec.rb +42 -0
- data/spec/models/issue_config_validation_spec.rb +42 -0
- data/spec/models/issue_deadline_spec.rb +36 -0
- data/spec/models/issue_form_field_spec.rb +60 -0
- data/spec/models/issue_labels_option_spec.rb +42 -0
- data/spec/models/issue_meta_spec.rb +48 -0
- data/spec/models/issue_spec.rb +180 -0
- data/spec/models/issue_template_spec.rb +78 -0
- data/spec/models/label_spec.rb +72 -0
- data/spec/models/label_template_spec.rb +54 -0
- data/spec/models/license_template_info_spec.rb +60 -0
- data/spec/models/licenses_template_list_entry_spec.rb +48 -0
- data/spec/models/markdown_option_spec.rb +54 -0
- data/spec/models/markup_option_spec.rb +60 -0
- data/spec/models/merge_pull_request_option_spec.rb +82 -0
- data/spec/models/migrate_repo_options_spec.rb +154 -0
- data/spec/models/milestone_spec.rb +90 -0
- data/spec/models/new_issue_pins_allowed_spec.rb +42 -0
- data/spec/models/node_info_services_spec.rb +42 -0
- data/spec/models/node_info_software_spec.rb +54 -0
- data/spec/models/node_info_spec.rb +72 -0
- data/spec/models/node_info_usage_spec.rb +48 -0
- data/spec/models/node_info_usage_users_spec.rb +48 -0
- data/spec/models/note_spec.rb +42 -0
- data/spec/models/notification_count_spec.rb +36 -0
- data/spec/models/notification_subject_spec.rb +72 -0
- data/spec/models/notification_thread_spec.rb +72 -0
- data/spec/models/o_auth2_application_spec.rb +72 -0
- data/spec/models/organization_permissions_spec.rb +60 -0
- data/spec/models/organization_spec.rb +96 -0
- data/spec/models/package_file_spec.rb +72 -0
- data/spec/models/package_spec.rb +84 -0
- data/spec/models/payload_commit_spec.rb +90 -0
- data/spec/models/payload_commit_verification_spec.rb +60 -0
- data/spec/models/payload_user_spec.rb +48 -0
- data/spec/models/permission_spec.rb +48 -0
- data/spec/models/pr_branch_info_spec.rb +60 -0
- data/spec/models/public_key_spec.rb +84 -0
- data/spec/models/pull_request_meta_spec.rb +54 -0
- data/spec/models/pull_request_spec.rb +246 -0
- data/spec/models/pull_review_comment_spec.rb +120 -0
- data/spec/models/pull_review_request_options_spec.rb +42 -0
- data/spec/models/pull_review_spec.rb +114 -0
- data/spec/models/push_mirror_spec.rb +78 -0
- data/spec/models/reaction_spec.rb +48 -0
- data/spec/models/reference_spec.rb +48 -0
- data/spec/models/release_spec.rb +138 -0
- data/spec/models/rename_user_option_spec.rb +36 -0
- data/spec/models/replace_flags_option_spec.rb +36 -0
- data/spec/models/repo_collaborator_permission_spec.rb +48 -0
- data/spec/models/repo_commit_spec.rb +66 -0
- data/spec/models/repo_create_release_attachment_request_spec.rb +36 -0
- data/spec/models/repo_topic_options_spec.rb +36 -0
- data/spec/models/repo_transfer_spec.rb +48 -0
- data/spec/models/repository_meta_spec.rb +54 -0
- data/spec/models/repository_spec.rb +406 -0
- data/spec/models/search_results_spec.rb +42 -0
- data/spec/models/secret_spec.rb +42 -0
- data/spec/models/server_version_spec.rb +36 -0
- data/spec/models/stop_watch_spec.rb +72 -0
- data/spec/models/submit_pull_review_options_spec.rb +42 -0
- data/spec/models/tag_archive_download_count_spec.rb +42 -0
- data/spec/models/tag_protection_spec.rb +66 -0
- data/spec/models/tag_spec.rb +72 -0
- data/spec/models/team_search200_response_spec.rb +42 -0
- data/spec/models/team_spec.rb +88 -0
- data/spec/models/timeline_comment_spec.rb +204 -0
- data/spec/models/topic_name_spec.rb +36 -0
- data/spec/models/topic_response_spec.rb +60 -0
- data/spec/models/tracked_time_spec.rb +72 -0
- data/spec/models/transfer_repo_option_spec.rb +42 -0
- data/spec/models/update_file_options_spec.rb +90 -0
- data/spec/models/update_repo_avatar_option_spec.rb +36 -0
- data/spec/models/update_user_avatar_option_spec.rb +36 -0
- data/spec/models/update_variable_option_spec.rb +42 -0
- data/spec/models/user_heatmap_data_spec.rb +42 -0
- data/spec/models/user_search200_response_spec.rb +42 -0
- data/spec/models/user_settings_options_spec.rb +96 -0
- data/spec/models/user_settings_spec.rb +96 -0
- data/spec/models/user_spec.rb +168 -0
- data/spec/models/watch_info_spec.rb +66 -0
- data/spec/models/wiki_commit_list_spec.rb +42 -0
- data/spec/models/wiki_commit_spec.rb +54 -0
- data/spec/models/wiki_page_meta_data_spec.rb +54 -0
- data/spec/models/wiki_page_spec.rb +78 -0
- data/spec/spec_helper.rb +111 -0
- data/swagger.v1.json +26802 -0
- data/swagger.v1.patched.json +1 -0
- metadata +949 -0
@@ -0,0 +1,437 @@
|
|
1
|
+
=begin
|
2
|
+
#Forgejo API
|
3
|
+
|
4
|
+
#This documentation describes the Forgejo API.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 8.0.3-53-9d5cce4bcc+gitea-1.22.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.9.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'json'
|
15
|
+
require 'logger'
|
16
|
+
require 'tempfile'
|
17
|
+
require 'time'
|
18
|
+
require 'faraday'
|
19
|
+
require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
|
20
|
+
require 'marcel'
|
21
|
+
|
22
|
+
|
23
|
+
module Forgejo
|
24
|
+
class ApiClient
|
25
|
+
# The Configuration object holding settings to be used in the API client.
|
26
|
+
attr_accessor :config
|
27
|
+
|
28
|
+
# Defines the headers to be used in HTTP requests of all API calls by default.
|
29
|
+
#
|
30
|
+
# @return [Hash]
|
31
|
+
attr_accessor :default_headers
|
32
|
+
|
33
|
+
# Initializes the ApiClient
|
34
|
+
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
35
|
+
def initialize(config = Configuration.default)
|
36
|
+
@config = config
|
37
|
+
@user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
|
38
|
+
@default_headers = {
|
39
|
+
'Content-Type' => 'application/json',
|
40
|
+
'User-Agent' => @user_agent
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.default
|
45
|
+
@@default ||= ApiClient.new
|
46
|
+
end
|
47
|
+
|
48
|
+
# Call an API with given options.
|
49
|
+
#
|
50
|
+
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
51
|
+
# the data deserialized from response body (could be nil), response status code and response headers.
|
52
|
+
def call_api(http_method, path, opts = {})
|
53
|
+
stream = nil
|
54
|
+
begin
|
55
|
+
response = connection(opts).public_send(http_method.to_sym.downcase) do |req|
|
56
|
+
request = build_request(http_method, path, req, opts)
|
57
|
+
stream = download_file(request) if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
|
58
|
+
end
|
59
|
+
|
60
|
+
if config.debugging
|
61
|
+
config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
62
|
+
end
|
63
|
+
|
64
|
+
unless response.success?
|
65
|
+
if response.status == 0 && response.respond_to?(:return_message)
|
66
|
+
# Errors from libcurl will be made visible here
|
67
|
+
fail ApiError.new(code: 0,
|
68
|
+
message: response.return_message)
|
69
|
+
else
|
70
|
+
fail ApiError.new(code: response.status,
|
71
|
+
response_headers: response.headers,
|
72
|
+
response_body: response.body),
|
73
|
+
response.reason_phrase
|
74
|
+
end
|
75
|
+
end
|
76
|
+
rescue Faraday::TimeoutError
|
77
|
+
fail ApiError.new('Connection timed out')
|
78
|
+
rescue Faraday::ConnectionFailed
|
79
|
+
fail ApiError.new('Connection failed')
|
80
|
+
end
|
81
|
+
|
82
|
+
if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
|
83
|
+
data = deserialize_file(response, stream)
|
84
|
+
elsif opts[:return_type]
|
85
|
+
data = deserialize(response, opts[:return_type])
|
86
|
+
else
|
87
|
+
data = nil
|
88
|
+
end
|
89
|
+
return data, response.status, response.headers
|
90
|
+
end
|
91
|
+
|
92
|
+
# Builds the HTTP request
|
93
|
+
#
|
94
|
+
# @param [String] http_method HTTP method/verb (e.g. POST)
|
95
|
+
# @param [String] path URL path (e.g. /account/new)
|
96
|
+
# @option opts [Hash] :header_params Header parameters
|
97
|
+
# @option opts [Hash] :query_params Query parameters
|
98
|
+
# @option opts [Hash] :form_params Query parameters
|
99
|
+
# @option opts [Object] :body HTTP body (JSON/XML)
|
100
|
+
# @return [Faraday::Request] A Faraday Request
|
101
|
+
def build_request(http_method, path, request, opts = {})
|
102
|
+
url = build_request_url(path, opts)
|
103
|
+
http_method = http_method.to_sym.downcase
|
104
|
+
|
105
|
+
header_params = @default_headers.merge(opts[:header_params] || {})
|
106
|
+
query_params = opts[:query_params] || {}
|
107
|
+
form_params = opts[:form_params] || {}
|
108
|
+
|
109
|
+
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
110
|
+
|
111
|
+
if [:post, :patch, :put, :delete].include?(http_method)
|
112
|
+
req_body = build_request_body(header_params, form_params, opts[:body])
|
113
|
+
if config.debugging
|
114
|
+
config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
request.headers = header_params
|
118
|
+
request.body = req_body
|
119
|
+
|
120
|
+
# Overload default options only if provided
|
121
|
+
request.options.params_encoder = config.params_encoder if config.params_encoder
|
122
|
+
request.options.timeout = config.timeout if config.timeout
|
123
|
+
|
124
|
+
request.url url
|
125
|
+
request.params = query_params
|
126
|
+
request
|
127
|
+
end
|
128
|
+
|
129
|
+
# Builds the HTTP request body
|
130
|
+
#
|
131
|
+
# @param [Hash] header_params Header parameters
|
132
|
+
# @param [Hash] form_params Query parameters
|
133
|
+
# @param [Object] body HTTP body (JSON/XML)
|
134
|
+
# @return [String] HTTP body data in the form of string
|
135
|
+
def build_request_body(header_params, form_params, body)
|
136
|
+
# http form
|
137
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded'
|
138
|
+
data = URI.encode_www_form(form_params)
|
139
|
+
elsif header_params['Content-Type'] == 'multipart/form-data'
|
140
|
+
data = {}
|
141
|
+
form_params.each do |key, value|
|
142
|
+
case value
|
143
|
+
when ::File, ::Tempfile
|
144
|
+
data[key] = Faraday::FilePart.new(value.path, Marcel::MimeType.for(Pathname.new(value.path)))
|
145
|
+
when ::Array, nil
|
146
|
+
# let Faraday handle Array and nil parameters
|
147
|
+
data[key] = value
|
148
|
+
else
|
149
|
+
data[key] = value.to_s
|
150
|
+
end
|
151
|
+
end
|
152
|
+
elsif body
|
153
|
+
data = body.is_a?(String) ? body : body.to_json
|
154
|
+
else
|
155
|
+
data = nil
|
156
|
+
end
|
157
|
+
data
|
158
|
+
end
|
159
|
+
|
160
|
+
def download_file(request)
|
161
|
+
stream = []
|
162
|
+
|
163
|
+
# handle streaming Responses
|
164
|
+
request.options.on_data = Proc.new do |chunk, overall_received_bytes|
|
165
|
+
stream << chunk
|
166
|
+
end
|
167
|
+
|
168
|
+
stream
|
169
|
+
end
|
170
|
+
|
171
|
+
def deserialize_file(response, stream)
|
172
|
+
body = response.body
|
173
|
+
encoding = body.encoding
|
174
|
+
|
175
|
+
# reconstruct content
|
176
|
+
content = stream.join
|
177
|
+
content = content.unpack('m').join if response.headers['Content-Transfer-Encoding'] == 'binary'
|
178
|
+
content = content.force_encoding(encoding)
|
179
|
+
|
180
|
+
# return byte stream
|
181
|
+
return content if @config.return_binary_data == true
|
182
|
+
|
183
|
+
# return file instead of binary data
|
184
|
+
content_disposition = response.headers['Content-Disposition']
|
185
|
+
if content_disposition && content_disposition =~ /filename=/i
|
186
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
187
|
+
prefix = sanitize_filename(filename)
|
188
|
+
else
|
189
|
+
prefix = 'download-'
|
190
|
+
end
|
191
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
192
|
+
|
193
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
194
|
+
tempfile.write(content)
|
195
|
+
tempfile.close
|
196
|
+
|
197
|
+
config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
198
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
199
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
200
|
+
"explicitly with `tempfile.delete`"
|
201
|
+
tempfile
|
202
|
+
end
|
203
|
+
|
204
|
+
def connection(opts)
|
205
|
+
opts[:header_params]['Content-Type'] == 'multipart/form-data' ? connection_multipart : connection_regular
|
206
|
+
end
|
207
|
+
|
208
|
+
def connection_multipart
|
209
|
+
@connection_multipart ||= build_connection do |conn|
|
210
|
+
conn.request :multipart
|
211
|
+
conn.request :url_encoded
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def connection_regular
|
216
|
+
@connection_regular ||= build_connection
|
217
|
+
end
|
218
|
+
|
219
|
+
def build_connection
|
220
|
+
Faraday.new(url: config.base_url, ssl: ssl_options, proxy: config.proxy) do |conn|
|
221
|
+
basic_auth(conn)
|
222
|
+
config.configure_middleware(conn)
|
223
|
+
yield(conn) if block_given?
|
224
|
+
conn.adapter(Faraday.default_adapter)
|
225
|
+
config.configure_connection(conn)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
def ssl_options
|
230
|
+
{
|
231
|
+
ca_file: config.ssl_ca_file,
|
232
|
+
verify: config.ssl_verify,
|
233
|
+
verify_mode: config.ssl_verify_mode,
|
234
|
+
client_cert: config.ssl_client_cert,
|
235
|
+
client_key: config.ssl_client_key
|
236
|
+
}
|
237
|
+
end
|
238
|
+
|
239
|
+
def basic_auth(conn)
|
240
|
+
if config.username && config.password
|
241
|
+
if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
|
242
|
+
conn.request(:authorization, :basic, config.username, config.password)
|
243
|
+
else
|
244
|
+
conn.request(:basic_auth, config.username, config.password)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
# Check if the given MIME is a JSON MIME.
|
250
|
+
# JSON MIME examples:
|
251
|
+
# application/json
|
252
|
+
# application/json; charset=UTF8
|
253
|
+
# APPLICATION/JSON
|
254
|
+
# */*
|
255
|
+
# @param [String] mime MIME
|
256
|
+
# @return [Boolean] True if the MIME is application/json
|
257
|
+
def json_mime?(mime)
|
258
|
+
(mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
|
259
|
+
end
|
260
|
+
|
261
|
+
# Deserialize the response to the given return type.
|
262
|
+
#
|
263
|
+
# @param [Response] response HTTP response
|
264
|
+
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
265
|
+
def deserialize(response, return_type)
|
266
|
+
body = response.body
|
267
|
+
return nil if body.nil? || body.empty?
|
268
|
+
|
269
|
+
# return response body directly for String return type
|
270
|
+
return body.to_s if return_type == 'String'
|
271
|
+
|
272
|
+
# ensuring a default content type
|
273
|
+
content_type = response.headers['Content-Type'] || 'application/json'
|
274
|
+
|
275
|
+
fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
276
|
+
|
277
|
+
begin
|
278
|
+
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
279
|
+
rescue JSON::ParserError => e
|
280
|
+
if %w(String Date Time).include?(return_type)
|
281
|
+
data = body
|
282
|
+
else
|
283
|
+
raise e
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
convert_to_type data, return_type
|
288
|
+
end
|
289
|
+
|
290
|
+
# Convert data to the given return type.
|
291
|
+
# @param [Object] data Data to be converted
|
292
|
+
# @param [String] return_type Return type
|
293
|
+
# @return [Mixed] Data in a particular type
|
294
|
+
def convert_to_type(data, return_type)
|
295
|
+
return nil if data.nil?
|
296
|
+
case return_type
|
297
|
+
when 'String'
|
298
|
+
data.to_s
|
299
|
+
when 'Integer'
|
300
|
+
data.to_i
|
301
|
+
when 'Float'
|
302
|
+
data.to_f
|
303
|
+
when 'Boolean'
|
304
|
+
data == true
|
305
|
+
when 'Time'
|
306
|
+
# parse date time (expecting ISO 8601 format)
|
307
|
+
Time.parse data
|
308
|
+
when 'Date'
|
309
|
+
# parse date time (expecting ISO 8601 format)
|
310
|
+
Date.parse data
|
311
|
+
when 'Object'
|
312
|
+
# generic object (usually a Hash), return directly
|
313
|
+
data
|
314
|
+
when /\AArray<(.+)>\z/
|
315
|
+
# e.g. Array<Pet>
|
316
|
+
sub_type = $1
|
317
|
+
data.map { |item| convert_to_type(item, sub_type) }
|
318
|
+
when /\AHash\<String, (.+)\>\z/
|
319
|
+
# e.g. Hash<String, Integer>
|
320
|
+
sub_type = $1
|
321
|
+
{}.tap do |hash|
|
322
|
+
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
323
|
+
end
|
324
|
+
else
|
325
|
+
# models (e.g. Pet) or oneOf
|
326
|
+
klass = Forgejo.const_get(return_type)
|
327
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
# Sanitize filename by removing path.
|
332
|
+
# e.g. ../../sun.gif becomes sun.gif
|
333
|
+
#
|
334
|
+
# @param [String] filename the filename to be sanitized
|
335
|
+
# @return [String] the sanitized filename
|
336
|
+
def sanitize_filename(filename)
|
337
|
+
filename.split(/[\/\\]/).last
|
338
|
+
end
|
339
|
+
|
340
|
+
def build_request_url(path, opts = {})
|
341
|
+
# Add leading and trailing slashes to path
|
342
|
+
path = "/#{path}".gsub(/\/+/, '/')
|
343
|
+
@config.base_url(opts[:operation]) + path
|
344
|
+
end
|
345
|
+
|
346
|
+
# Update header and query params based on authentication settings.
|
347
|
+
#
|
348
|
+
# @param [Hash] header_params Header parameters
|
349
|
+
# @param [Hash] query_params Query parameters
|
350
|
+
# @param [String] auth_names Authentication scheme name
|
351
|
+
def update_params_for_auth!(header_params, query_params, auth_names)
|
352
|
+
Array(auth_names).each do |auth_name|
|
353
|
+
auth_setting = @config.auth_settings[auth_name]
|
354
|
+
next unless auth_setting
|
355
|
+
case auth_setting[:in]
|
356
|
+
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
357
|
+
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
358
|
+
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
|
359
|
+
end
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
# Sets user agent in HTTP header
|
364
|
+
#
|
365
|
+
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
|
366
|
+
def user_agent=(user_agent)
|
367
|
+
@user_agent = user_agent
|
368
|
+
@default_headers['User-Agent'] = @user_agent
|
369
|
+
end
|
370
|
+
|
371
|
+
# Return Accept header based on an array of accepts provided.
|
372
|
+
# @param [Array] accepts array for Accept
|
373
|
+
# @return [String] the Accept header (e.g. application/json)
|
374
|
+
def select_header_accept(accepts)
|
375
|
+
return nil if accepts.nil? || accepts.empty?
|
376
|
+
# use JSON when present, otherwise use all of the provided
|
377
|
+
json_accept = accepts.find { |s| json_mime?(s) }
|
378
|
+
json_accept || accepts.join(',')
|
379
|
+
end
|
380
|
+
|
381
|
+
# Return Content-Type header based on an array of content types provided.
|
382
|
+
# @param [Array] content_types array for Content-Type
|
383
|
+
# @return [String] the Content-Type header (e.g. application/json)
|
384
|
+
def select_header_content_type(content_types)
|
385
|
+
# return nil by default
|
386
|
+
return if content_types.nil? || content_types.empty?
|
387
|
+
# use JSON when present, otherwise use the first one
|
388
|
+
json_content_type = content_types.find { |s| json_mime?(s) }
|
389
|
+
json_content_type || content_types.first
|
390
|
+
end
|
391
|
+
|
392
|
+
# Convert object (array, hash, object, etc) to JSON string.
|
393
|
+
# @param [Object] model object to be converted into JSON string
|
394
|
+
# @return [String] JSON string representation of the object
|
395
|
+
def object_to_http_body(model)
|
396
|
+
return model if model.nil? || model.is_a?(String)
|
397
|
+
local_body = nil
|
398
|
+
if model.is_a?(Array)
|
399
|
+
local_body = model.map { |m| object_to_hash(m) }
|
400
|
+
else
|
401
|
+
local_body = object_to_hash(model)
|
402
|
+
end
|
403
|
+
local_body.to_json
|
404
|
+
end
|
405
|
+
|
406
|
+
# Convert object(non-array) to hash.
|
407
|
+
# @param [Object] obj object to be converted into JSON string
|
408
|
+
# @return [String] JSON string representation of the object
|
409
|
+
def object_to_hash(obj)
|
410
|
+
if obj.respond_to?(:to_hash)
|
411
|
+
obj.to_hash
|
412
|
+
else
|
413
|
+
obj
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
# Build parameter value according to the given collection format.
|
418
|
+
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
|
419
|
+
def build_collection_param(param, collection_format)
|
420
|
+
case collection_format
|
421
|
+
when :csv
|
422
|
+
param.join(',')
|
423
|
+
when :ssv
|
424
|
+
param.join(' ')
|
425
|
+
when :tsv
|
426
|
+
param.join("\t")
|
427
|
+
when :pipes
|
428
|
+
param.join('|')
|
429
|
+
when :multi
|
430
|
+
# return the array directly as typhoeus will handle it as expected
|
431
|
+
param
|
432
|
+
else
|
433
|
+
fail "unknown collection format: #{collection_format.inspect}"
|
434
|
+
end
|
435
|
+
end
|
436
|
+
end
|
437
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
=begin
|
2
|
+
#Forgejo API
|
3
|
+
|
4
|
+
#This documentation describes the Forgejo API.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 8.0.3-53-9d5cce4bcc+gitea-1.22.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.9.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module Forgejo
|
14
|
+
class ApiError < StandardError
|
15
|
+
attr_reader :code, :response_headers, :response_body
|
16
|
+
|
17
|
+
# Usage examples:
|
18
|
+
# ApiError.new
|
19
|
+
# ApiError.new("message")
|
20
|
+
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
21
|
+
# ApiError.new(:code => 404, :message => "Not Found")
|
22
|
+
def initialize(arg = nil)
|
23
|
+
if arg.is_a? Hash
|
24
|
+
if arg.key?(:message) || arg.key?('message')
|
25
|
+
super(arg[:message] || arg['message'])
|
26
|
+
else
|
27
|
+
super arg
|
28
|
+
end
|
29
|
+
|
30
|
+
arg.each do |k, v|
|
31
|
+
instance_variable_set "@#{k}", v
|
32
|
+
end
|
33
|
+
else
|
34
|
+
super arg
|
35
|
+
@message = arg
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Override to_s to display a friendly error message
|
40
|
+
def to_s
|
41
|
+
message
|
42
|
+
end
|
43
|
+
|
44
|
+
def message
|
45
|
+
if @message.nil?
|
46
|
+
msg = "Error message: the server returns an error"
|
47
|
+
else
|
48
|
+
msg = @message
|
49
|
+
end
|
50
|
+
|
51
|
+
msg += "\nHTTP status code: #{code}" if code
|
52
|
+
msg += "\nResponse headers: #{response_headers}" if response_headers
|
53
|
+
msg += "\nResponse body: #{response_body}" if response_body
|
54
|
+
|
55
|
+
msg
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|