gitabu 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/.rspec +3 -0
- data/.rubocop.yml +33 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +65 -0
- data/LICENSE.txt +21 -0
- data/README.md +42 -0
- data/Rakefile +12 -0
- data/gitabu.gemspec +41 -0
- data/lib/gitabu/api/v3/actions.rb +3724 -0
- data/lib/gitabu/api/v3/activity.rb +835 -0
- data/lib/gitabu/api/v3/apps.rb +961 -0
- data/lib/gitabu/api/v3/billing.rb +217 -0
- data/lib/gitabu/api/v3/branches.rb +1098 -0
- data/lib/gitabu/api/v3/checks.rb +384 -0
- data/lib/gitabu/api/v3/code_scanning.rb +315 -0
- data/lib/gitabu/api/v3/codes_of_conduct.rb +92 -0
- data/lib/gitabu/api/v3/codespaces.rb +650 -0
- data/lib/gitabu/api/v3/collaborators.rb +341 -0
- data/lib/gitabu/api/v3/commits.rb +428 -0
- data/lib/gitabu/api/v3/dependabot.rb +419 -0
- data/lib/gitabu/api/v3/deploy_keys.rb +152 -0
- data/lib/gitabu/api/v3/deployments.rb +356 -0
- data/lib/gitabu/api/v3/emojis.rb +67 -0
- data/lib/gitabu/api/v3/enterprise_admin.rb +495 -0
- data/lib/gitabu/api/v3/gists.rb +552 -0
- data/lib/gitabu/api/v3/git.rb +409 -0
- data/lib/gitabu/api/v3/gitignore.rb +92 -0
- data/lib/gitabu/api/v3/interactions.rb +275 -0
- data/lib/gitabu/api/v3/issues.rb +1119 -0
- data/lib/gitabu/api/v3/licenses.rb +118 -0
- data/lib/gitabu/api/v3/markdown.rb +94 -0
- data/lib/gitabu/api/v3/meta.rb +142 -0
- data/lib/gitabu/api/v3/metrics.rb +302 -0
- data/lib/gitabu/api/v3/migrations.rb +631 -0
- data/lib/gitabu/api/v3/orgs.rb +1291 -0
- data/lib/gitabu/api/v3/packages.rb +686 -0
- data/lib/gitabu/api/v3/pages.rb +282 -0
- data/lib/gitabu/api/v3/projects.rb +693 -0
- data/lib/gitabu/api/v3/pulls.rb +816 -0
- data/lib/gitabu/api/v3/rate_limit.rb +67 -0
- data/lib/gitabu/api/v3/reactions.rb +734 -0
- data/lib/gitabu/api/v3/releases.rb +411 -0
- data/lib/gitabu/api/v3/repos.rb +1136 -0
- data/lib/gitabu/api/v3/scim.rb +214 -0
- data/lib/gitabu/api/v3/search.rb +217 -0
- data/lib/gitabu/api/v3/secret_scanning.rb +201 -0
- data/lib/gitabu/api/v3/teams.rb +1963 -0
- data/lib/gitabu/api/v3/users.rb +851 -0
- data/lib/gitabu/api/v3/webhooks.rb +379 -0
- data/lib/gitabu/builder.rb +37 -0
- data/lib/gitabu/client.rb +8 -0
- data/lib/gitabu/generator.rb +75 -0
- data/lib/gitabu/http_client.rb +96 -0
- data/lib/gitabu/items.rb +110 -0
- data/lib/gitabu/public/api/v3/actions.json +5779 -0
- data/lib/gitabu/public/api/v3/activity.json +1248 -0
- data/lib/gitabu/public/api/v3/apps.json +1174 -0
- data/lib/gitabu/public/api/v3/billing.json +183 -0
- data/lib/gitabu/public/api/v3/branches.json +1886 -0
- data/lib/gitabu/public/api/v3/checks.json +856 -0
- data/lib/gitabu/public/api/v3/code_scanning.json +666 -0
- data/lib/gitabu/public/api/v3/codes_of_conduct.json +41 -0
- data/lib/gitabu/public/api/v3/codespaces.json +884 -0
- data/lib/gitabu/public/api/v3/collaborators.json +464 -0
- data/lib/gitabu/public/api/v3/commits.json +830 -0
- data/lib/gitabu/public/api/v3/dependabot.json +596 -0
- data/lib/gitabu/public/api/v3/deploy_keys.json +195 -0
- data/lib/gitabu/public/api/v3/deployments.json +698 -0
- data/lib/gitabu/public/api/v3/emojis.json +18 -0
- data/lib/gitabu/public/api/v3/enterprise_admin.json +881 -0
- data/lib/gitabu/public/api/v3/gists.json +689 -0
- data/lib/gitabu/public/api/v3/git.json +735 -0
- data/lib/gitabu/public/api/v3/gitignore.json +41 -0
- data/lib/gitabu/public/api/v3/interactions.json +265 -0
- data/lib/gitabu/public/api/v3/issues.json +2359 -0
- data/lib/gitabu/public/api/v3/licenses.json +100 -0
- data/lib/gitabu/public/api/v3/markdown.json +59 -0
- data/lib/gitabu/public/api/v3/meta.json +69 -0
- data/lib/gitabu/public/api/v3/metrics.json +342 -0
- data/lib/gitabu/public/api/v3/migrations.json +960 -0
- data/lib/gitabu/public/api/v3/orgs.json +1989 -0
- data/lib/gitabu/public/api/v3/packages.json +1078 -0
- data/lib/gitabu/public/api/v3/pages.json +373 -0
- data/lib/gitabu/public/api/v3/projects.json +966 -0
- data/lib/gitabu/public/api/v3/pulls.json +1768 -0
- data/lib/gitabu/public/api/v3/rate_limit.json +18 -0
- data/lib/gitabu/public/api/v3/reactions.json +1425 -0
- data/lib/gitabu/public/api/v3/releases.json +753 -0
- data/lib/gitabu/public/api/v3/repos.json +2314 -0
- data/lib/gitabu/public/api/v3/scim.json +412 -0
- data/lib/gitabu/public/api/v3/search.json +408 -0
- data/lib/gitabu/public/api/v3/secret_scanning.json +385 -0
- data/lib/gitabu/public/api/v3/teams.json +3126 -0
- data/lib/gitabu/public/api/v3/users.json +956 -0
- data/lib/gitabu/public/api/v3/webhooks.json +667 -0
- data/lib/gitabu/run.rb +237 -0
- data/lib/gitabu/scraper.rb +86 -0
- data/lib/gitabu/templates/template.rb.erb +70 -0
- data/lib/gitabu/version.rb +6 -0
- data/lib/gitabu.rb +57 -0
- data/sig/gitabu.rbs +4 -0
- metadata +177 -0
@@ -0,0 +1,1136 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# INFO ON GENERATED CODE
|
4
|
+
#
|
5
|
+
# This file is generated.
|
6
|
+
# See the contribution guide on how to improve the code.
|
7
|
+
#
|
8
|
+
# INFO ON GENERATED CODE
|
9
|
+
|
10
|
+
# Ruby gem that helps you work with Github API.
|
11
|
+
module Gitabu
|
12
|
+
# API module
|
13
|
+
module Api
|
14
|
+
# Github Version 3
|
15
|
+
module V3
|
16
|
+
# Class to display Repos result
|
17
|
+
class ReposResult
|
18
|
+
attr_accessor :result, :message
|
19
|
+
|
20
|
+
def initialize(result:, message:)
|
21
|
+
@result = result
|
22
|
+
@message = message
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Class to display error result
|
27
|
+
class ReposErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Repos endpoints.
|
37
|
+
class Repos
|
38
|
+
def self.list_organization_repositories(org: nil, options: nil)
|
39
|
+
new.list_organization_repositories(org, options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.create_an_organization_repository(org: nil, name: nil, description: nil, homepage: nil, private: nil, visibility: nil, has_issues: nil, has_projects: nil, has_wiki: nil, is_template: nil, team_id: nil, auto_init: nil, gitignore_template: nil, license_template: nil, allow_squash_merge: nil, allow_merge_commit: nil, allow_rebase_merge: nil, allow_auto_merge: nil, delete_branch_on_merge: nil, options: nil)
|
43
|
+
new.create_an_organization_repository(org, name, description, homepage, private, visibility, has_issues, has_projects, has_wiki, is_template, team_id, auto_init, gitignore_template, license_template, allow_squash_merge, allow_merge_commit, allow_rebase_merge, allow_auto_merge, delete_branch_on_merge, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.get_a_repository(owner: nil, repo: nil, options: nil)
|
47
|
+
new.get_a_repository(owner, repo, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.update_a_repository(owner: nil, repo: nil, name: nil, description: nil, homepage: nil, private: nil, visibility: nil, security_and_analysis: nil, has_issues: nil, has_projects: nil, has_wiki: nil, is_template: nil, default_branch: nil, allow_squash_merge: nil, allow_merge_commit: nil, allow_rebase_merge: nil, allow_auto_merge: nil, delete_branch_on_merge: nil, archived: nil, allow_forking: nil, options: nil)
|
51
|
+
new.update_a_repository(owner, repo, name, description, homepage, private, visibility, security_and_analysis, has_issues, has_projects, has_wiki, is_template, default_branch, allow_squash_merge, allow_merge_commit, allow_rebase_merge, allow_auto_merge, delete_branch_on_merge, archived, allow_forking, options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.delete_a_repository(owner: nil, repo: nil, options: nil)
|
55
|
+
new.delete_a_repository(owner, repo, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.enable_automated_security_fixes(owner: nil, repo: nil, options: nil)
|
59
|
+
new.enable_automated_security_fixes(owner, repo, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.disable_automated_security_fixes(owner: nil, repo: nil, options: nil)
|
63
|
+
new.disable_automated_security_fixes(owner, repo, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.list_codeowners_errors(owner: nil, repo: nil, options: nil)
|
67
|
+
new.list_codeowners_errors(owner, repo, options)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.list_repository_contributors(owner: nil, repo: nil, options: nil)
|
71
|
+
new.list_repository_contributors(owner, repo, options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.create_a_repository_dispatch_event(owner: nil, repo: nil, event_type: nil, client_payload: nil, options: nil)
|
75
|
+
new.create_a_repository_dispatch_event(owner, repo, event_type, client_payload, options)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.list_repository_languages(owner: nil, repo: nil, options: nil)
|
79
|
+
new.list_repository_languages(owner, repo, options)
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.list_repository_tags(owner: nil, repo: nil, options: nil)
|
83
|
+
new.list_repository_tags(owner, repo, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.list_repository_teams(owner: nil, repo: nil, options: nil)
|
87
|
+
new.list_repository_teams(owner, repo, options)
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.get_all_repository_topics(owner: nil, repo: nil, options: nil)
|
91
|
+
new.get_all_repository_topics(owner, repo, options)
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.replace_all_repository_topics(owner: nil, repo: nil, names: nil, options: nil)
|
95
|
+
new.replace_all_repository_topics(owner, repo, names, options)
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.transfer_a_repository(owner: nil, repo: nil, new_owner: nil, team_ids: nil, options: nil)
|
99
|
+
new.transfer_a_repository(owner, repo, new_owner, team_ids, options)
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.check_if_vulnerability_alerts_are_enabled_for_a_repository(owner: nil, repo: nil, options: nil)
|
103
|
+
new.check_if_vulnerability_alerts_are_enabled_for_a_repository(owner, repo, options)
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.enable_vulnerability_alerts(owner: nil, repo: nil, options: nil)
|
107
|
+
new.enable_vulnerability_alerts(owner, repo, options)
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.disable_vulnerability_alerts(owner: nil, repo: nil, options: nil)
|
111
|
+
new.disable_vulnerability_alerts(owner, repo, options)
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.create_a_repository_using_a_template(template_owner: nil, template_repo: nil, owner: nil, name: nil, description: nil, include_all_branches: nil, private: nil, options: nil)
|
115
|
+
new.create_a_repository_using_a_template(template_owner, template_repo, owner, name, description, include_all_branches, private, options)
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.list_public_repositories(options: nil)
|
119
|
+
new.list_public_repositories(options)
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.list_repositories_for_the_authenticated_user(options: nil)
|
123
|
+
new.list_repositories_for_the_authenticated_user(options)
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.create_a_repository_for_the_authenticated_user(name: nil, description: nil, homepage: nil, private: nil, has_issues: nil, has_projects: nil, has_wiki: nil, team_id: nil, auto_init: nil, gitignore_template: nil, license_template: nil, allow_squash_merge: nil, allow_merge_commit: nil, allow_rebase_merge: nil, allow_auto_merge: nil, delete_branch_on_merge: nil, has_downloads: nil, is_template: nil, options: nil)
|
127
|
+
new.create_a_repository_for_the_authenticated_user(name, description, homepage, private, has_issues, has_projects, has_wiki, team_id, auto_init, gitignore_template, license_template, allow_squash_merge, allow_merge_commit, allow_rebase_merge, allow_auto_merge, delete_branch_on_merge, has_downloads, is_template, options)
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.list_repositories_for_a_user(username: nil, options: nil)
|
131
|
+
new.list_repositories_for_a_user(username, options)
|
132
|
+
end
|
133
|
+
|
134
|
+
def self.list_all_autolinks_of_a_repository(owner: nil, repo: nil, options: nil)
|
135
|
+
new.list_all_autolinks_of_a_repository(owner, repo, options)
|
136
|
+
end
|
137
|
+
|
138
|
+
def self.create_an_autolink_reference_for_a_repository(owner: nil, repo: nil, key_prefix: nil, url_template: nil, options: nil)
|
139
|
+
new.create_an_autolink_reference_for_a_repository(owner, repo, key_prefix, url_template, options)
|
140
|
+
end
|
141
|
+
|
142
|
+
def self.get_an_autolink_reference_of_a_repository(owner: nil, repo: nil, autolink_id: nil, options: nil)
|
143
|
+
new.get_an_autolink_reference_of_a_repository(owner, repo, autolink_id, options)
|
144
|
+
end
|
145
|
+
|
146
|
+
def self.delete_an_autolink_reference_from_a_repository(owner: nil, repo: nil, autolink_id: nil, options: nil)
|
147
|
+
new.delete_an_autolink_reference_from_a_repository(owner, repo, autolink_id, options)
|
148
|
+
end
|
149
|
+
|
150
|
+
def self.get_repository_content(owner: nil, repo: nil, path: nil, options: nil)
|
151
|
+
new.get_repository_content(owner, repo, path, options)
|
152
|
+
end
|
153
|
+
|
154
|
+
def self.create_or_update_file_contents(owner: nil, repo: nil, path: nil, message: nil, content: nil, sha: nil, branch: nil, committer: nil, author: nil, options: nil)
|
155
|
+
new.create_or_update_file_contents(owner, repo, path, message, content, sha, branch, committer, author, options)
|
156
|
+
end
|
157
|
+
|
158
|
+
def self.delete_a_file(owner: nil, repo: nil, path: nil, message: nil, sha: nil, branch: nil, committer: nil, author: nil, options: nil)
|
159
|
+
new.delete_a_file(owner, repo, path, message, sha, branch, committer, author, options)
|
160
|
+
end
|
161
|
+
|
162
|
+
def self.get_a_repository_readme(owner: nil, repo: nil, options: nil)
|
163
|
+
new.get_a_repository_readme(owner, repo, options)
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.get_a_repository_readme_for_a_directory(owner: nil, repo: nil, dir: nil, options: nil)
|
167
|
+
new.get_a_repository_readme_for_a_directory(owner, repo, dir, options)
|
168
|
+
end
|
169
|
+
|
170
|
+
def self.download_a_repository_archive_tar(owner: nil, repo: nil, ref: nil, options: nil)
|
171
|
+
new.download_a_repository_archive_tar(owner, repo, ref, options)
|
172
|
+
end
|
173
|
+
|
174
|
+
def self.download_a_repository_archive_zip(owner: nil, repo: nil, ref: nil, options: nil)
|
175
|
+
new.download_a_repository_archive_zip(owner, repo, ref, options)
|
176
|
+
end
|
177
|
+
|
178
|
+
def self.list_forks(owner: nil, repo: nil, options: nil)
|
179
|
+
new.list_forks(owner, repo, options)
|
180
|
+
end
|
181
|
+
|
182
|
+
def self.create_a_fork(owner: nil, repo: nil, organization: nil, options: nil)
|
183
|
+
new.create_a_fork(owner, repo, organization, options)
|
184
|
+
end
|
185
|
+
|
186
|
+
def self.enable_git_lfs_for_a_repository(owner: nil, repo: nil, options: nil)
|
187
|
+
new.enable_git_lfs_for_a_repository(owner, repo, options)
|
188
|
+
end
|
189
|
+
|
190
|
+
def self.disable_git_lfs_for_a_repository(owner: nil, repo: nil, options: nil)
|
191
|
+
new.disable_git_lfs_for_a_repository(owner, repo, options)
|
192
|
+
end
|
193
|
+
|
194
|
+
private
|
195
|
+
|
196
|
+
# list organization repositories
|
197
|
+
#
|
198
|
+
# @param org [String]
|
199
|
+
#
|
200
|
+
# @return ReposResult, ReposErrorResult
|
201
|
+
def list_organization_repositories(org, options)
|
202
|
+
auth = nil
|
203
|
+
body = nil
|
204
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
205
|
+
params = { type: options[:type], sort: options[:sort], direction: options[:direction], per_page: options[:per_page], page: options[:page] }
|
206
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/repos"
|
207
|
+
|
208
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
209
|
+
|
210
|
+
if http_call.successful?
|
211
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
212
|
+
else
|
213
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
# create an organization repository
|
218
|
+
#
|
219
|
+
# @param org [String]
|
220
|
+
# @param name [String] Required. The name of the repository.
|
221
|
+
# @param description [String] A short description of the repository.
|
222
|
+
# @param homepage [String] A URL with more information about the repository.
|
223
|
+
# @param private [Boolean] Whether the repository is private.
|
224
|
+
# @param visibility [String] Can be public or private. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, visibility can also be internal. Note: For GitHub Enterprise Server and GitHub AE, this endpoint will only list repositories available to all users on the enterprise. For more information, see "Creating an internal repository" in the GitHub Help documentation.
|
225
|
+
# @param has_issues [Boolean] Either true to enable issues for this repository or false to disable them.Default:
|
226
|
+
# @param has_projects [Boolean] Either true to enable projects for this repository or false to disable them. Note: If you're creating a repository in an organization that has disabled repository projects, the default is false, and if you pass true, the API returns an error.Default:
|
227
|
+
# @param has_wiki [Boolean] Either true to enable the wiki for this repository or false to disable it.Default:
|
228
|
+
# @param is_template [Boolean] Either true to make this repo available as a template repository or false to prevent it.
|
229
|
+
# @param team_id [Integer] The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.
|
230
|
+
# @param auto_init [Boolean] Pass true to create an initial commit with empty README.
|
231
|
+
# @param gitignore_template [String] Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell".
|
232
|
+
# @param license_template [String] Choose an open source license template that best suits your needs, and then use the license keyword as the license_template string. For example, "mit" or "mpl-2.0".
|
233
|
+
# @param allow_squash_merge [Boolean] Either true to allow squash-merging pull requests, or false to prevent squash-merging.Default:
|
234
|
+
# @param allow_merge_commit [Boolean] Either true to allow merging pull requests with a merge commit, or false to prevent merging pull requests with merge commits.Default:
|
235
|
+
# @param allow_rebase_merge [Boolean] Either true to allow rebase-merging pull requests, or false to prevent rebase-merging.Default:
|
236
|
+
# @param allow_auto_merge [Boolean] Either true to allow auto-merge on pull requests, or false to disallow auto-merge.
|
237
|
+
# @param delete_branch_on_merge [Boolean] Either true to allow automatically deleting head branches when pull requests are merged, or false to prevent automatic deletion.
|
238
|
+
#
|
239
|
+
# @return ReposResult, ReposErrorResult
|
240
|
+
def create_an_organization_repository(org, name, description, homepage, private, visibility, has_issues, has_projects, has_wiki, is_template, team_id, auto_init, gitignore_template, license_template, allow_squash_merge, allow_merge_commit, allow_rebase_merge, allow_auto_merge, delete_branch_on_merge, _options)
|
241
|
+
auth = nil
|
242
|
+
body = { name: name, description: description, homepage: homepage, private: private, visibility: visibility, has_issues: has_issues, has_projects: has_projects, has_wiki: has_wiki, is_template: is_template, team_id: team_id, auto_init: auto_init, gitignore_template: gitignore_template, license_template: license_template, allow_squash_merge: allow_squash_merge, allow_merge_commit: allow_merge_commit, allow_rebase_merge: allow_rebase_merge, allow_auto_merge: allow_auto_merge, delete_branch_on_merge: delete_branch_on_merge }
|
243
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
244
|
+
params = nil
|
245
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/repos"
|
246
|
+
|
247
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
248
|
+
|
249
|
+
if http_call.successful?
|
250
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
251
|
+
else
|
252
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
# get a repository
|
257
|
+
#
|
258
|
+
# @param owner [String]
|
259
|
+
# @param repo [String]
|
260
|
+
#
|
261
|
+
# @return ReposResult, ReposErrorResult
|
262
|
+
def get_a_repository(owner, repo, _options)
|
263
|
+
auth = nil
|
264
|
+
body = nil
|
265
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
266
|
+
params = nil
|
267
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}"
|
268
|
+
|
269
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
270
|
+
|
271
|
+
if http_call.successful?
|
272
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
273
|
+
else
|
274
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
# update a repository
|
279
|
+
#
|
280
|
+
# @param owner [String]
|
281
|
+
# @param repo [String]
|
282
|
+
# @param name [String] The name of the repository.
|
283
|
+
# @param description [String] A short description of the repository.
|
284
|
+
# @param homepage [String] A URL with more information about the repository.
|
285
|
+
# @param private [Boolean] Either true to make the repository private or false to make it public. Default: false.
|
286
|
+
# Note: You will get a 422 error if the organization restricts changing repository visibility to organization owners and a non-owner tries to change the value of private. Note: You will get a 422 error if the organization restricts changing repository visibility to organization owners and a non-owner tries to change the value of private.
|
287
|
+
# @param visibility [String] Can be public or private. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, visibility can also be internal."
|
288
|
+
# @param security_and_analysis [Object or null] Specify which security and analysis features to enable or disable. For example, to enable GitHub Advanced Security, use this data in the body of the PATCH request: {"security_and_analysis": {"advanced_security": {"status": "enabled"}}}. If you have admin permissions for a private repository covered by an Advanced Security license, you can check which security and analysis features are currently enabled by using a GET /repos/{owner}/{repo} request.
|
289
|
+
# @param has_issues [Boolean] Either true to enable issues for this repository or false to disable them.Default:
|
290
|
+
# @param has_projects [Boolean] Either true to enable projects for this repository or false to disable them. Note: If you're creating a repository in an organization that has disabled repository projects, the default is false, and if you pass true, the API returns an error.Default:
|
291
|
+
# @param has_wiki [Boolean] Either true to enable the wiki for this repository or false to disable it.Default:
|
292
|
+
# @param is_template [Boolean] Either true to make this repo available as a template repository or false to prevent it.
|
293
|
+
# @param default_branch [String] Updates the default branch for this repository.
|
294
|
+
# @param allow_squash_merge [Boolean] Either true to allow squash-merging pull requests, or false to prevent squash-merging.Default:
|
295
|
+
# @param allow_merge_commit [Boolean] Either true to allow merging pull requests with a merge commit, or false to prevent merging pull requests with merge commits.Default:
|
296
|
+
# @param allow_rebase_merge [Boolean] Either true to allow rebase-merging pull requests, or false to prevent rebase-merging.Default:
|
297
|
+
# @param allow_auto_merge [Boolean] Either true to allow auto-merge on pull requests, or false to disallow auto-merge.
|
298
|
+
# @param delete_branch_on_merge [Boolean] Either true to allow automatically deleting head branches when pull requests are merged, or false to prevent automatic deletion.
|
299
|
+
# @param archived [Boolean] true to archive this repository. Note: You cannot unarchive repositories through the API.
|
300
|
+
# @param allow_forking [Boolean] Either true to allow private forks, or false to prevent private forks.
|
301
|
+
#
|
302
|
+
# @return ReposResult, ReposErrorResult
|
303
|
+
def update_a_repository(owner, repo, name, description, homepage, private, visibility, security_and_analysis, has_issues, has_projects, has_wiki, is_template, default_branch, allow_squash_merge, allow_merge_commit, allow_rebase_merge, allow_auto_merge, delete_branch_on_merge, archived, allow_forking, _options)
|
304
|
+
auth = nil
|
305
|
+
body = { name: name, description: description, homepage: homepage, private: private, visibility: visibility, security_and_analysis: security_and_analysis, has_issues: has_issues, has_projects: has_projects, has_wiki: has_wiki, is_template: is_template, default_branch: default_branch, allow_squash_merge: allow_squash_merge, allow_merge_commit: allow_merge_commit, allow_rebase_merge: allow_rebase_merge, allow_auto_merge: allow_auto_merge, delete_branch_on_merge: delete_branch_on_merge, archived: archived, allow_forking: allow_forking }
|
306
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
307
|
+
params = nil
|
308
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}"
|
309
|
+
|
310
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
|
311
|
+
|
312
|
+
if http_call.successful?
|
313
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
314
|
+
else
|
315
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
# delete a repository
|
320
|
+
#
|
321
|
+
# @param owner [String]
|
322
|
+
# @param repo [String]
|
323
|
+
#
|
324
|
+
# @return ReposResult, ReposErrorResult
|
325
|
+
def delete_a_repository(owner, repo, _options)
|
326
|
+
auth = nil
|
327
|
+
body = nil
|
328
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
329
|
+
params = nil
|
330
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}"
|
331
|
+
|
332
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
333
|
+
|
334
|
+
if http_call.successful?
|
335
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
336
|
+
else
|
337
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
# enable automated security fixes
|
342
|
+
#
|
343
|
+
# @param owner [String]
|
344
|
+
# @param repo [String]
|
345
|
+
#
|
346
|
+
# @return ReposResult, ReposErrorResult
|
347
|
+
def enable_automated_security_fixes(owner, repo, _options)
|
348
|
+
auth = nil
|
349
|
+
body = nil
|
350
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
351
|
+
params = nil
|
352
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/automated-security-fixes"
|
353
|
+
|
354
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
355
|
+
|
356
|
+
if http_call.successful?
|
357
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
358
|
+
else
|
359
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
# disable automated security fixes
|
364
|
+
#
|
365
|
+
# @param owner [String]
|
366
|
+
# @param repo [String]
|
367
|
+
#
|
368
|
+
# @return ReposResult, ReposErrorResult
|
369
|
+
def disable_automated_security_fixes(owner, repo, _options)
|
370
|
+
auth = nil
|
371
|
+
body = nil
|
372
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
373
|
+
params = nil
|
374
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/automated-security-fixes"
|
375
|
+
|
376
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
377
|
+
|
378
|
+
if http_call.successful?
|
379
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
380
|
+
else
|
381
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
# list codeowners errors
|
386
|
+
#
|
387
|
+
# @param owner [String]
|
388
|
+
# @param repo [String]
|
389
|
+
#
|
390
|
+
# @return ReposResult, ReposErrorResult
|
391
|
+
def list_codeowners_errors(owner, repo, options)
|
392
|
+
auth = nil
|
393
|
+
body = nil
|
394
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
395
|
+
params = { ref: options[:ref] }
|
396
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/codeowners/errors"
|
397
|
+
|
398
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
399
|
+
|
400
|
+
if http_call.successful?
|
401
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
402
|
+
else
|
403
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
407
|
+
# list repository contributors
|
408
|
+
#
|
409
|
+
# @param owner [String]
|
410
|
+
# @param repo [String]
|
411
|
+
#
|
412
|
+
# @return ReposResult, ReposErrorResult
|
413
|
+
def list_repository_contributors(owner, repo, options)
|
414
|
+
auth = nil
|
415
|
+
body = nil
|
416
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
417
|
+
params = { anon: options[:anon], per_page: options[:per_page], page: options[:page] }
|
418
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/contributors"
|
419
|
+
|
420
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
421
|
+
|
422
|
+
if http_call.successful?
|
423
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
424
|
+
else
|
425
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
# create a repository dispatch event
|
430
|
+
#
|
431
|
+
# @param owner [String]
|
432
|
+
# @param repo [String]
|
433
|
+
# @param event_type [String] Required. A custom webhook event name.
|
434
|
+
# @param client_payload [Object] JSON payload with extra information about the webhook event that your action or worklow may use.
|
435
|
+
#
|
436
|
+
# @return ReposResult, ReposErrorResult
|
437
|
+
def create_a_repository_dispatch_event(owner, repo, event_type, client_payload, _options)
|
438
|
+
auth = nil
|
439
|
+
body = { event_type: event_type, client_payload: client_payload }
|
440
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
441
|
+
params = nil
|
442
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/dispatches"
|
443
|
+
|
444
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
445
|
+
|
446
|
+
if http_call.successful?
|
447
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
448
|
+
else
|
449
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
# list repository languages
|
454
|
+
#
|
455
|
+
# @param owner [String]
|
456
|
+
# @param repo [String]
|
457
|
+
#
|
458
|
+
# @return ReposResult, ReposErrorResult
|
459
|
+
def list_repository_languages(owner, repo, _options)
|
460
|
+
auth = nil
|
461
|
+
body = nil
|
462
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
463
|
+
params = nil
|
464
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/languages"
|
465
|
+
|
466
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
467
|
+
|
468
|
+
if http_call.successful?
|
469
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
470
|
+
else
|
471
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
472
|
+
end
|
473
|
+
end
|
474
|
+
|
475
|
+
# list repository tags
|
476
|
+
#
|
477
|
+
# @param owner [String]
|
478
|
+
# @param repo [String]
|
479
|
+
#
|
480
|
+
# @return ReposResult, ReposErrorResult
|
481
|
+
def list_repository_tags(owner, repo, options)
|
482
|
+
auth = nil
|
483
|
+
body = nil
|
484
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
485
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
486
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/tags"
|
487
|
+
|
488
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
489
|
+
|
490
|
+
if http_call.successful?
|
491
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
492
|
+
else
|
493
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
494
|
+
end
|
495
|
+
end
|
496
|
+
|
497
|
+
# list repository teams
|
498
|
+
#
|
499
|
+
# @param owner [String]
|
500
|
+
# @param repo [String]
|
501
|
+
#
|
502
|
+
# @return ReposResult, ReposErrorResult
|
503
|
+
def list_repository_teams(owner, repo, options)
|
504
|
+
auth = nil
|
505
|
+
body = nil
|
506
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
507
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
508
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/teams"
|
509
|
+
|
510
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
511
|
+
|
512
|
+
if http_call.successful?
|
513
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
514
|
+
else
|
515
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
519
|
+
# get all repository topics
|
520
|
+
#
|
521
|
+
# @param owner [String]
|
522
|
+
# @param repo [String]
|
523
|
+
#
|
524
|
+
# @return ReposResult, ReposErrorResult
|
525
|
+
def get_all_repository_topics(owner, repo, options)
|
526
|
+
auth = nil
|
527
|
+
body = nil
|
528
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
529
|
+
params = { page: options[:page], per_page: options[:per_page] }
|
530
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/topics"
|
531
|
+
|
532
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
533
|
+
|
534
|
+
if http_call.successful?
|
535
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
536
|
+
else
|
537
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
538
|
+
end
|
539
|
+
end
|
540
|
+
|
541
|
+
# replace all repository topics
|
542
|
+
#
|
543
|
+
# @param owner [String]
|
544
|
+
# @param repo [String]
|
545
|
+
# @param names [Array of strings] Required. An array of topics to add to the repository. Pass one or more topics to replace the set of existing topics. Send an empty array ([]) to clear all topics from the repository. Note: Topic names cannot contain uppercase letters.
|
546
|
+
#
|
547
|
+
# @return ReposResult, ReposErrorResult
|
548
|
+
def replace_all_repository_topics(owner, repo, names, _options)
|
549
|
+
auth = nil
|
550
|
+
body = { names: names }
|
551
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
552
|
+
params = nil
|
553
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/topics"
|
554
|
+
|
555
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
556
|
+
|
557
|
+
if http_call.successful?
|
558
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
559
|
+
else
|
560
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
561
|
+
end
|
562
|
+
end
|
563
|
+
|
564
|
+
# transfer a repository
|
565
|
+
#
|
566
|
+
# @param owner [String]
|
567
|
+
# @param repo [String]
|
568
|
+
# @param new_owner [String] Required. The username or organization name the repository will be transferred to.
|
569
|
+
# @param team_ids [Array of integers] ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories.
|
570
|
+
#
|
571
|
+
# @return ReposResult, ReposErrorResult
|
572
|
+
def transfer_a_repository(owner, repo, new_owner, team_ids, _options)
|
573
|
+
auth = nil
|
574
|
+
body = { new_owner: new_owner, team_ids: team_ids }
|
575
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
576
|
+
params = nil
|
577
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/transfer"
|
578
|
+
|
579
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
580
|
+
|
581
|
+
if http_call.successful?
|
582
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
583
|
+
else
|
584
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
585
|
+
end
|
586
|
+
end
|
587
|
+
|
588
|
+
# check if vulnerability alerts are enabled for a repository
|
589
|
+
#
|
590
|
+
# @param owner [String]
|
591
|
+
# @param repo [String]
|
592
|
+
#
|
593
|
+
# @return ReposResult, ReposErrorResult
|
594
|
+
def check_if_vulnerability_alerts_are_enabled_for_a_repository(owner, repo, _options)
|
595
|
+
auth = nil
|
596
|
+
body = nil
|
597
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
598
|
+
params = nil
|
599
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/vulnerability-alerts"
|
600
|
+
|
601
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
602
|
+
|
603
|
+
if http_call.successful?
|
604
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
605
|
+
else
|
606
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
607
|
+
end
|
608
|
+
end
|
609
|
+
|
610
|
+
# enable vulnerability alerts
|
611
|
+
#
|
612
|
+
# @param owner [String]
|
613
|
+
# @param repo [String]
|
614
|
+
#
|
615
|
+
# @return ReposResult, ReposErrorResult
|
616
|
+
def enable_vulnerability_alerts(owner, repo, _options)
|
617
|
+
auth = nil
|
618
|
+
body = nil
|
619
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
620
|
+
params = nil
|
621
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/vulnerability-alerts"
|
622
|
+
|
623
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
624
|
+
|
625
|
+
if http_call.successful?
|
626
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
627
|
+
else
|
628
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
629
|
+
end
|
630
|
+
end
|
631
|
+
|
632
|
+
# disable vulnerability alerts
|
633
|
+
#
|
634
|
+
# @param owner [String]
|
635
|
+
# @param repo [String]
|
636
|
+
#
|
637
|
+
# @return ReposResult, ReposErrorResult
|
638
|
+
def disable_vulnerability_alerts(owner, repo, _options)
|
639
|
+
auth = nil
|
640
|
+
body = nil
|
641
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
642
|
+
params = nil
|
643
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/vulnerability-alerts"
|
644
|
+
|
645
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
646
|
+
|
647
|
+
if http_call.successful?
|
648
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
649
|
+
else
|
650
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
651
|
+
end
|
652
|
+
end
|
653
|
+
|
654
|
+
# create a repository using a template
|
655
|
+
#
|
656
|
+
# @param template_owner [String]
|
657
|
+
# @param template_repo [String]
|
658
|
+
# @param owner [String] The organization or person who will own the new repository. To create a new repository in an organization, the authenticated user must be a member of the specified organization.
|
659
|
+
# @param name [String] Required. The name of the new repository.
|
660
|
+
# @param description [String] A short description of the new repository.
|
661
|
+
# @param include_all_branches [Boolean] Set to true to include the directory structure and files from all branches in the template repository, and not just the default branch. Default: false.
|
662
|
+
# @param private [Boolean] Either true to create a new private repository or false to create a new public one.
|
663
|
+
#
|
664
|
+
# @return ReposResult, ReposErrorResult
|
665
|
+
def create_a_repository_using_a_template(template_owner, template_repo, owner, name, description, include_all_branches, private, _options)
|
666
|
+
auth = nil
|
667
|
+
body = { owner: owner, name: name, description: description, include_all_branches: include_all_branches, private: private }
|
668
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
669
|
+
params = nil
|
670
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{template_owner}/#{template_repo}/generate"
|
671
|
+
|
672
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
673
|
+
|
674
|
+
if http_call.successful?
|
675
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
676
|
+
else
|
677
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
678
|
+
end
|
679
|
+
end
|
680
|
+
|
681
|
+
# list public repositories
|
682
|
+
#
|
683
|
+
# @params options [Hash]
|
684
|
+
#
|
685
|
+
# @return ReposResult, ReposErrorResult
|
686
|
+
def list_public_repositories(options)
|
687
|
+
auth = nil
|
688
|
+
body = nil
|
689
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
690
|
+
params = { since: options[:since] }
|
691
|
+
uri = "#{Gitabu::BASE_URL}/repositories"
|
692
|
+
|
693
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
694
|
+
|
695
|
+
if http_call.successful?
|
696
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
697
|
+
else
|
698
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
699
|
+
end
|
700
|
+
end
|
701
|
+
|
702
|
+
# list repositories for the authenticated user
|
703
|
+
#
|
704
|
+
# @params options [Hash]
|
705
|
+
#
|
706
|
+
# @return ReposResult, ReposErrorResult
|
707
|
+
def list_repositories_for_the_authenticated_user(options)
|
708
|
+
auth = nil
|
709
|
+
body = nil
|
710
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
711
|
+
params = { visibility: options[:visibility], affiliation: options[:affiliation], type: options[:type], sort: options[:sort], direction: options[:direction], per_page: options[:per_page], page: options[:page], since: options[:since], before: options[:before] }
|
712
|
+
uri = "#{Gitabu::BASE_URL}/user/repos"
|
713
|
+
|
714
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
715
|
+
|
716
|
+
if http_call.successful?
|
717
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
718
|
+
else
|
719
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
720
|
+
end
|
721
|
+
end
|
722
|
+
|
723
|
+
# create a repository for the authenticated user
|
724
|
+
#
|
725
|
+
# @param name [String] Required. The name of the repository.
|
726
|
+
# @param description [String] A short description of the repository.
|
727
|
+
# @param homepage [String] A URL with more information about the repository.
|
728
|
+
# @param private [Boolean] Whether the repository is private.
|
729
|
+
# @param has_issues [Boolean] Whether issues are enabled.Default:
|
730
|
+
# @param has_projects [Boolean] Whether projects are enabled.Default:
|
731
|
+
# @param has_wiki [Boolean] Whether the wiki is enabled.Default:
|
732
|
+
# @param team_id [Integer] The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.
|
733
|
+
# @param auto_init [Boolean] Whether the repository is initialized with a minimal README.
|
734
|
+
# @param gitignore_template [String] The desired language or platform to apply to the .gitignore.
|
735
|
+
# @param license_template [String] The license keyword of the open source license for this repository.
|
736
|
+
# @param allow_squash_merge [Boolean] Whether to allow squash merges for pull requests.Default:
|
737
|
+
# @param allow_merge_commit [Boolean] Whether to allow merge commits for pull requests.Default:
|
738
|
+
# @param allow_rebase_merge [Boolean] Whether to allow rebase merges for pull requests.Default:
|
739
|
+
# @param allow_auto_merge [Boolean] Whether to allow Auto-merge to be used on pull requests.
|
740
|
+
# @param delete_branch_on_merge [Boolean] Whether to delete head branches when pull requests are merged
|
741
|
+
# @param has_downloads [Boolean] Whether downloads are enabled.Default:
|
742
|
+
# @param is_template [Boolean] Whether this repository acts as a template that can be used to generate new repositories.
|
743
|
+
#
|
744
|
+
# @return ReposResult, ReposErrorResult
|
745
|
+
def create_a_repository_for_the_authenticated_user(name, description, homepage, private, has_issues, has_projects, has_wiki, team_id, auto_init, gitignore_template, license_template, allow_squash_merge, allow_merge_commit, allow_rebase_merge, allow_auto_merge, delete_branch_on_merge, has_downloads, is_template, _options)
|
746
|
+
auth = nil
|
747
|
+
body = { name: name, description: description, homepage: homepage, private: private, has_issues: has_issues, has_projects: has_projects, has_wiki: has_wiki, team_id: team_id, auto_init: auto_init, gitignore_template: gitignore_template, license_template: license_template, allow_squash_merge: allow_squash_merge, allow_merge_commit: allow_merge_commit, allow_rebase_merge: allow_rebase_merge, allow_auto_merge: allow_auto_merge, delete_branch_on_merge: delete_branch_on_merge, has_downloads: has_downloads, is_template: is_template }
|
748
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
749
|
+
params = nil
|
750
|
+
uri = "#{Gitabu::BASE_URL}/user/repos"
|
751
|
+
|
752
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
753
|
+
|
754
|
+
if http_call.successful?
|
755
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
756
|
+
else
|
757
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
758
|
+
end
|
759
|
+
end
|
760
|
+
|
761
|
+
# list repositories for a user
|
762
|
+
#
|
763
|
+
# @param username [String]
|
764
|
+
#
|
765
|
+
# @return ReposResult, ReposErrorResult
|
766
|
+
def list_repositories_for_a_user(username, options)
|
767
|
+
auth = nil
|
768
|
+
body = nil
|
769
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
770
|
+
params = { type: options[:type], sort: options[:sort], direction: options[:direction], per_page: options[:per_page], page: options[:page] }
|
771
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/repos"
|
772
|
+
|
773
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
774
|
+
|
775
|
+
if http_call.successful?
|
776
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
777
|
+
else
|
778
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
779
|
+
end
|
780
|
+
end
|
781
|
+
|
782
|
+
# list all autolinks of a repository
|
783
|
+
#
|
784
|
+
# @param owner [String]
|
785
|
+
# @param repo [String]
|
786
|
+
#
|
787
|
+
# @return ReposResult, ReposErrorResult
|
788
|
+
def list_all_autolinks_of_a_repository(owner, repo, options)
|
789
|
+
auth = nil
|
790
|
+
body = nil
|
791
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
792
|
+
params = { page: options[:page] }
|
793
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/autolinks"
|
794
|
+
|
795
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
796
|
+
|
797
|
+
if http_call.successful?
|
798
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
799
|
+
else
|
800
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
801
|
+
end
|
802
|
+
end
|
803
|
+
|
804
|
+
# create an autolink reference for a repository
|
805
|
+
#
|
806
|
+
# @param owner [String]
|
807
|
+
# @param repo [String]
|
808
|
+
# @param key_prefix [String] Required. The prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.
|
809
|
+
# @param url_template [String] Required. The URL must contain for the reference number.
|
810
|
+
#
|
811
|
+
# @return ReposResult, ReposErrorResult
|
812
|
+
def create_an_autolink_reference_for_a_repository(owner, repo, key_prefix, url_template, _options)
|
813
|
+
auth = nil
|
814
|
+
body = { key_prefix: key_prefix, url_template: url_template }
|
815
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
816
|
+
params = nil
|
817
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/autolinks"
|
818
|
+
|
819
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
820
|
+
|
821
|
+
if http_call.successful?
|
822
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
823
|
+
else
|
824
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
825
|
+
end
|
826
|
+
end
|
827
|
+
|
828
|
+
# get an autolink reference of a repository
|
829
|
+
#
|
830
|
+
# @param owner [String]
|
831
|
+
# @param repo [String]
|
832
|
+
# @param autolink_id [Integer] autolink_id parameter
|
833
|
+
#
|
834
|
+
# @return ReposResult, ReposErrorResult
|
835
|
+
def get_an_autolink_reference_of_a_repository(owner, repo, autolink_id, _options)
|
836
|
+
auth = nil
|
837
|
+
body = nil
|
838
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
839
|
+
params = nil
|
840
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/autolinks/#{autolink_id}"
|
841
|
+
|
842
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
843
|
+
|
844
|
+
if http_call.successful?
|
845
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
846
|
+
else
|
847
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
848
|
+
end
|
849
|
+
end
|
850
|
+
|
851
|
+
# delete an autolink reference from a repository
|
852
|
+
#
|
853
|
+
# @param owner [String]
|
854
|
+
# @param repo [String]
|
855
|
+
# @param autolink_id [Integer] autolink_id parameter
|
856
|
+
#
|
857
|
+
# @return ReposResult, ReposErrorResult
|
858
|
+
def delete_an_autolink_reference_from_a_repository(owner, repo, autolink_id, _options)
|
859
|
+
auth = nil
|
860
|
+
body = nil
|
861
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
862
|
+
params = nil
|
863
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/autolinks/#{autolink_id}"
|
864
|
+
|
865
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
866
|
+
|
867
|
+
if http_call.successful?
|
868
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
869
|
+
else
|
870
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
871
|
+
end
|
872
|
+
end
|
873
|
+
|
874
|
+
# get repository content
|
875
|
+
#
|
876
|
+
# @param owner [String]
|
877
|
+
# @param repo [String]
|
878
|
+
# @param path [String] path parameter
|
879
|
+
#
|
880
|
+
# @return ReposResult, ReposErrorResult
|
881
|
+
def get_repository_content(owner, repo, path, options)
|
882
|
+
auth = nil
|
883
|
+
body = nil
|
884
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
885
|
+
params = { ref: options[:ref] }
|
886
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/contents/#{path}"
|
887
|
+
|
888
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
889
|
+
|
890
|
+
if http_call.successful?
|
891
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
892
|
+
else
|
893
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
894
|
+
end
|
895
|
+
end
|
896
|
+
|
897
|
+
# create or update file contents
|
898
|
+
#
|
899
|
+
# @param owner [String]
|
900
|
+
# @param repo [String]
|
901
|
+
# @param path [String] path parameter
|
902
|
+
# @param message [String] Required. The commit message.
|
903
|
+
# @param content [String] Required. The new file content, using Base64 encoding.
|
904
|
+
# @param sha [String] Required if you are updating a file. The blob SHA of the file being replaced.
|
905
|
+
# @param branch [String] The branch name. Default: the repository’s default branch (usually master)
|
906
|
+
# @param committer [Object] The person that committed the file. Default: the authenticated user.
|
907
|
+
# @param author [Object] The author of the file. Default: The committer or the authenticated user if you omit committer.
|
908
|
+
#
|
909
|
+
# @return ReposResult, ReposErrorResult
|
910
|
+
def create_or_update_file_contents(owner, repo, path, message, content, sha, branch, committer, author, _options)
|
911
|
+
auth = nil
|
912
|
+
body = { message: message, content: content, sha: sha, branch: branch, committer: committer, author: author }
|
913
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
914
|
+
params = nil
|
915
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/contents/#{path}"
|
916
|
+
|
917
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
918
|
+
|
919
|
+
if http_call.successful?
|
920
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
921
|
+
else
|
922
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
923
|
+
end
|
924
|
+
end
|
925
|
+
|
926
|
+
# delete a file
|
927
|
+
#
|
928
|
+
# @param owner [String]
|
929
|
+
# @param repo [String]
|
930
|
+
# @param path [String] path parameter
|
931
|
+
# @param message [String] Required. The commit message.
|
932
|
+
# @param sha [String] Required. The blob SHA of the file being replaced.
|
933
|
+
# @param branch [String] The branch name. Default: the repository’s default branch (usually master)
|
934
|
+
# @param committer [Object] object containing information about the committer.
|
935
|
+
# @param author [Object] object containing information about the author.
|
936
|
+
#
|
937
|
+
# @return ReposResult, ReposErrorResult
|
938
|
+
def delete_a_file(owner, repo, path, message, sha, branch, committer, author, _options)
|
939
|
+
auth = nil
|
940
|
+
body = { message: message, sha: sha, branch: branch, committer: committer, author: author }
|
941
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
942
|
+
params = nil
|
943
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/contents/#{path}"
|
944
|
+
|
945
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
946
|
+
|
947
|
+
if http_call.successful?
|
948
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
949
|
+
else
|
950
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
951
|
+
end
|
952
|
+
end
|
953
|
+
|
954
|
+
# get a repository readme
|
955
|
+
#
|
956
|
+
# @param owner [String]
|
957
|
+
# @param repo [String]
|
958
|
+
#
|
959
|
+
# @return ReposResult, ReposErrorResult
|
960
|
+
def get_a_repository_readme(owner, repo, options)
|
961
|
+
auth = nil
|
962
|
+
body = nil
|
963
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
964
|
+
params = { ref: options[:ref] }
|
965
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/readme"
|
966
|
+
|
967
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
968
|
+
|
969
|
+
if http_call.successful?
|
970
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
971
|
+
else
|
972
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
973
|
+
end
|
974
|
+
end
|
975
|
+
|
976
|
+
# get a repository readme for a directory
|
977
|
+
#
|
978
|
+
# @param owner [String]
|
979
|
+
# @param repo [String]
|
980
|
+
# @param dir [String] The alternate path to look for a README file
|
981
|
+
#
|
982
|
+
# @return ReposResult, ReposErrorResult
|
983
|
+
def get_a_repository_readme_for_a_directory(owner, repo, dir, options)
|
984
|
+
auth = nil
|
985
|
+
body = nil
|
986
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
987
|
+
params = { ref: options[:ref] }
|
988
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/readme/#{dir}"
|
989
|
+
|
990
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
991
|
+
|
992
|
+
if http_call.successful?
|
993
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
994
|
+
else
|
995
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
996
|
+
end
|
997
|
+
end
|
998
|
+
|
999
|
+
# download a repository archive tar
|
1000
|
+
#
|
1001
|
+
# @param owner [String]
|
1002
|
+
# @param repo [String]
|
1003
|
+
# @param ref [String]
|
1004
|
+
#
|
1005
|
+
# @return ReposResult, ReposErrorResult
|
1006
|
+
def download_a_repository_archive_tar(owner, repo, ref, _options)
|
1007
|
+
auth = nil
|
1008
|
+
body = nil
|
1009
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
1010
|
+
params = nil
|
1011
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/tarball/#{ref}"
|
1012
|
+
|
1013
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
1014
|
+
|
1015
|
+
if http_call.successful?
|
1016
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
1017
|
+
else
|
1018
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
1019
|
+
end
|
1020
|
+
end
|
1021
|
+
|
1022
|
+
# download a repository archive zip
|
1023
|
+
#
|
1024
|
+
# @param owner [String]
|
1025
|
+
# @param repo [String]
|
1026
|
+
# @param ref [String]
|
1027
|
+
#
|
1028
|
+
# @return ReposResult, ReposErrorResult
|
1029
|
+
def download_a_repository_archive_zip(owner, repo, ref, _options)
|
1030
|
+
auth = nil
|
1031
|
+
body = nil
|
1032
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
1033
|
+
params = nil
|
1034
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/zipball/#{ref}"
|
1035
|
+
|
1036
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
1037
|
+
|
1038
|
+
if http_call.successful?
|
1039
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
1040
|
+
else
|
1041
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
1042
|
+
end
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
# list forks
|
1046
|
+
#
|
1047
|
+
# @param owner [String]
|
1048
|
+
# @param repo [String]
|
1049
|
+
#
|
1050
|
+
# @return ReposResult, ReposErrorResult
|
1051
|
+
def list_forks(owner, repo, options)
|
1052
|
+
auth = nil
|
1053
|
+
body = nil
|
1054
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
1055
|
+
params = { sort: options[:sort], per_page: options[:per_page], page: options[:page] }
|
1056
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/forks"
|
1057
|
+
|
1058
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
1059
|
+
|
1060
|
+
if http_call.successful?
|
1061
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
1062
|
+
else
|
1063
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
1064
|
+
end
|
1065
|
+
end
|
1066
|
+
|
1067
|
+
# create a fork
|
1068
|
+
#
|
1069
|
+
# @param owner [String]
|
1070
|
+
# @param repo [String]
|
1071
|
+
# @param organization [String] Optional parameter to specify the organization name if forking into an organization.
|
1072
|
+
#
|
1073
|
+
# @return ReposResult, ReposErrorResult
|
1074
|
+
def create_a_fork(owner, repo, organization, _options)
|
1075
|
+
auth = nil
|
1076
|
+
body = { organization: organization }
|
1077
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
1078
|
+
params = nil
|
1079
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/forks"
|
1080
|
+
|
1081
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
1082
|
+
|
1083
|
+
if http_call.successful?
|
1084
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
1085
|
+
else
|
1086
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
1087
|
+
end
|
1088
|
+
end
|
1089
|
+
|
1090
|
+
# enable git lfs for a repository
|
1091
|
+
#
|
1092
|
+
# @param owner [String]
|
1093
|
+
# @param repo [String]
|
1094
|
+
#
|
1095
|
+
# @return ReposResult, ReposErrorResult
|
1096
|
+
def enable_git_lfs_for_a_repository(owner, repo, _options)
|
1097
|
+
auth = nil
|
1098
|
+
body = nil
|
1099
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
1100
|
+
params = nil
|
1101
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/lfs"
|
1102
|
+
|
1103
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
1104
|
+
|
1105
|
+
if http_call.successful?
|
1106
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
1107
|
+
else
|
1108
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
1109
|
+
end
|
1110
|
+
end
|
1111
|
+
|
1112
|
+
# disable git lfs for a repository
|
1113
|
+
#
|
1114
|
+
# @param owner [String]
|
1115
|
+
# @param repo [String]
|
1116
|
+
#
|
1117
|
+
# @return ReposResult, ReposErrorResult
|
1118
|
+
def disable_git_lfs_for_a_repository(owner, repo, _options)
|
1119
|
+
auth = nil
|
1120
|
+
body = nil
|
1121
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
1122
|
+
params = nil
|
1123
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/lfs"
|
1124
|
+
|
1125
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
1126
|
+
|
1127
|
+
if http_call.successful?
|
1128
|
+
ReposResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
1129
|
+
else
|
1130
|
+
ReposErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
1131
|
+
end
|
1132
|
+
end
|
1133
|
+
end
|
1134
|
+
end
|
1135
|
+
end
|
1136
|
+
end
|