gitabu 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +33 -0
  4. data/CHANGELOG.md +3 -0
  5. data/Gemfile +10 -0
  6. data/Gemfile.lock +65 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +42 -0
  9. data/Rakefile +12 -0
  10. data/gitabu.gemspec +41 -0
  11. data/lib/gitabu/api/v3/actions.rb +3724 -0
  12. data/lib/gitabu/api/v3/activity.rb +835 -0
  13. data/lib/gitabu/api/v3/apps.rb +961 -0
  14. data/lib/gitabu/api/v3/billing.rb +217 -0
  15. data/lib/gitabu/api/v3/branches.rb +1098 -0
  16. data/lib/gitabu/api/v3/checks.rb +384 -0
  17. data/lib/gitabu/api/v3/code_scanning.rb +315 -0
  18. data/lib/gitabu/api/v3/codes_of_conduct.rb +92 -0
  19. data/lib/gitabu/api/v3/codespaces.rb +650 -0
  20. data/lib/gitabu/api/v3/collaborators.rb +341 -0
  21. data/lib/gitabu/api/v3/commits.rb +428 -0
  22. data/lib/gitabu/api/v3/dependabot.rb +419 -0
  23. data/lib/gitabu/api/v3/deploy_keys.rb +152 -0
  24. data/lib/gitabu/api/v3/deployments.rb +356 -0
  25. data/lib/gitabu/api/v3/emojis.rb +67 -0
  26. data/lib/gitabu/api/v3/enterprise_admin.rb +495 -0
  27. data/lib/gitabu/api/v3/gists.rb +552 -0
  28. data/lib/gitabu/api/v3/git.rb +409 -0
  29. data/lib/gitabu/api/v3/gitignore.rb +92 -0
  30. data/lib/gitabu/api/v3/interactions.rb +275 -0
  31. data/lib/gitabu/api/v3/issues.rb +1119 -0
  32. data/lib/gitabu/api/v3/licenses.rb +118 -0
  33. data/lib/gitabu/api/v3/markdown.rb +94 -0
  34. data/lib/gitabu/api/v3/meta.rb +142 -0
  35. data/lib/gitabu/api/v3/metrics.rb +302 -0
  36. data/lib/gitabu/api/v3/migrations.rb +631 -0
  37. data/lib/gitabu/api/v3/orgs.rb +1291 -0
  38. data/lib/gitabu/api/v3/packages.rb +686 -0
  39. data/lib/gitabu/api/v3/pages.rb +282 -0
  40. data/lib/gitabu/api/v3/projects.rb +693 -0
  41. data/lib/gitabu/api/v3/pulls.rb +816 -0
  42. data/lib/gitabu/api/v3/rate_limit.rb +67 -0
  43. data/lib/gitabu/api/v3/reactions.rb +734 -0
  44. data/lib/gitabu/api/v3/releases.rb +411 -0
  45. data/lib/gitabu/api/v3/repos.rb +1136 -0
  46. data/lib/gitabu/api/v3/scim.rb +214 -0
  47. data/lib/gitabu/api/v3/search.rb +217 -0
  48. data/lib/gitabu/api/v3/secret_scanning.rb +201 -0
  49. data/lib/gitabu/api/v3/teams.rb +1963 -0
  50. data/lib/gitabu/api/v3/users.rb +851 -0
  51. data/lib/gitabu/api/v3/webhooks.rb +379 -0
  52. data/lib/gitabu/builder.rb +37 -0
  53. data/lib/gitabu/client.rb +8 -0
  54. data/lib/gitabu/generator.rb +75 -0
  55. data/lib/gitabu/http_client.rb +96 -0
  56. data/lib/gitabu/items.rb +110 -0
  57. data/lib/gitabu/public/api/v3/actions.json +5779 -0
  58. data/lib/gitabu/public/api/v3/activity.json +1248 -0
  59. data/lib/gitabu/public/api/v3/apps.json +1174 -0
  60. data/lib/gitabu/public/api/v3/billing.json +183 -0
  61. data/lib/gitabu/public/api/v3/branches.json +1886 -0
  62. data/lib/gitabu/public/api/v3/checks.json +856 -0
  63. data/lib/gitabu/public/api/v3/code_scanning.json +666 -0
  64. data/lib/gitabu/public/api/v3/codes_of_conduct.json +41 -0
  65. data/lib/gitabu/public/api/v3/codespaces.json +884 -0
  66. data/lib/gitabu/public/api/v3/collaborators.json +464 -0
  67. data/lib/gitabu/public/api/v3/commits.json +830 -0
  68. data/lib/gitabu/public/api/v3/dependabot.json +596 -0
  69. data/lib/gitabu/public/api/v3/deploy_keys.json +195 -0
  70. data/lib/gitabu/public/api/v3/deployments.json +698 -0
  71. data/lib/gitabu/public/api/v3/emojis.json +18 -0
  72. data/lib/gitabu/public/api/v3/enterprise_admin.json +881 -0
  73. data/lib/gitabu/public/api/v3/gists.json +689 -0
  74. data/lib/gitabu/public/api/v3/git.json +735 -0
  75. data/lib/gitabu/public/api/v3/gitignore.json +41 -0
  76. data/lib/gitabu/public/api/v3/interactions.json +265 -0
  77. data/lib/gitabu/public/api/v3/issues.json +2359 -0
  78. data/lib/gitabu/public/api/v3/licenses.json +100 -0
  79. data/lib/gitabu/public/api/v3/markdown.json +59 -0
  80. data/lib/gitabu/public/api/v3/meta.json +69 -0
  81. data/lib/gitabu/public/api/v3/metrics.json +342 -0
  82. data/lib/gitabu/public/api/v3/migrations.json +960 -0
  83. data/lib/gitabu/public/api/v3/orgs.json +1989 -0
  84. data/lib/gitabu/public/api/v3/packages.json +1078 -0
  85. data/lib/gitabu/public/api/v3/pages.json +373 -0
  86. data/lib/gitabu/public/api/v3/projects.json +966 -0
  87. data/lib/gitabu/public/api/v3/pulls.json +1768 -0
  88. data/lib/gitabu/public/api/v3/rate_limit.json +18 -0
  89. data/lib/gitabu/public/api/v3/reactions.json +1425 -0
  90. data/lib/gitabu/public/api/v3/releases.json +753 -0
  91. data/lib/gitabu/public/api/v3/repos.json +2314 -0
  92. data/lib/gitabu/public/api/v3/scim.json +412 -0
  93. data/lib/gitabu/public/api/v3/search.json +408 -0
  94. data/lib/gitabu/public/api/v3/secret_scanning.json +385 -0
  95. data/lib/gitabu/public/api/v3/teams.json +3126 -0
  96. data/lib/gitabu/public/api/v3/users.json +956 -0
  97. data/lib/gitabu/public/api/v3/webhooks.json +667 -0
  98. data/lib/gitabu/run.rb +237 -0
  99. data/lib/gitabu/scraper.rb +86 -0
  100. data/lib/gitabu/templates/template.rb.erb +70 -0
  101. data/lib/gitabu/version.rb +6 -0
  102. data/lib/gitabu.rb +57 -0
  103. data/sig/gitabu.rbs +4 -0
  104. metadata +177 -0
@@ -0,0 +1,1291 @@
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 Orgs result
17
+ class OrgsResult
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 OrgsErrorResult
28
+ attr_accessor :result, :message
29
+
30
+ def initialize(result:, message:)
31
+ @result = result
32
+ @message = message
33
+ end
34
+ end
35
+
36
+ # Orgs endpoints.
37
+ class Orgs
38
+ def self.list_organizations(options: nil)
39
+ new.list_organizations(options)
40
+ end
41
+
42
+ def self.get_an_organization(org: nil, options: nil)
43
+ new.get_an_organization(org, options)
44
+ end
45
+
46
+ def self.update_an_organization(org: nil, billing_email: nil, company: nil, email: nil, twitter_username: nil, location: nil, name: nil, description: nil, has_organization_projects: nil, has_repository_projects: nil, default_repository_permission: nil, members_can_create_repositories: nil, members_can_create_internal_repositories: nil, members_can_create_private_repositories: nil, members_can_create_public_repositories: nil, members_allowed_repository_creation_type: nil, members_can_create_pages: nil, members_can_create_public_pages: nil, members_can_create_private_pages: nil, members_can_fork_private_repositories: nil, blog: nil, options: nil)
47
+ new.update_an_organization(org, billing_email, company, email, twitter_username, location, name, description, has_organization_projects, has_repository_projects, default_repository_permission, members_can_create_repositories, members_can_create_internal_repositories, members_can_create_private_repositories, members_can_create_public_repositories, members_allowed_repository_creation_type, members_can_create_pages, members_can_create_public_pages, members_can_create_private_pages, members_can_fork_private_repositories, blog, options)
48
+ end
49
+
50
+ def self.get_the_audit_log_for_an_organization(org: nil, options: nil)
51
+ new.get_the_audit_log_for_an_organization(org, options)
52
+ end
53
+
54
+ def self.list_saml_sso_authorizations_for_an_organization(org: nil, options: nil)
55
+ new.list_saml_sso_authorizations_for_an_organization(org, options)
56
+ end
57
+
58
+ def self.remove_a_saml_sso_authorization_for_an_organization(org: nil, credential_id: nil, options: nil)
59
+ new.remove_a_saml_sso_authorization_for_an_organization(org, credential_id, options)
60
+ end
61
+
62
+ def self.list_app_installations_for_an_organization(org: nil, options: nil)
63
+ new.list_app_installations_for_an_organization(org, options)
64
+ end
65
+
66
+ def self.list_organizations_for_the_authenticated_user(options: nil)
67
+ new.list_organizations_for_the_authenticated_user(options)
68
+ end
69
+
70
+ def self.list_organizations_for_a_user(username: nil, options: nil)
71
+ new.list_organizations_for_a_user(username, options)
72
+ end
73
+
74
+ def self.list_users_blocked_by_an_organization(org: nil, options: nil)
75
+ new.list_users_blocked_by_an_organization(org, options)
76
+ end
77
+
78
+ def self.check_if_a_user_is_blocked_by_an_organization(org: nil, username: nil, options: nil)
79
+ new.check_if_a_user_is_blocked_by_an_organization(org, username, options)
80
+ end
81
+
82
+ def self.block_a_user_from_an_organization(org: nil, username: nil, options: nil)
83
+ new.block_a_user_from_an_organization(org, username, options)
84
+ end
85
+
86
+ def self.unblock_a_user_from_an_organization(org: nil, username: nil, options: nil)
87
+ new.unblock_a_user_from_an_organization(org, username, options)
88
+ end
89
+
90
+ def self.list_custom_repository_roles_in_an_organization(organization_id: nil, options: nil)
91
+ new.list_custom_repository_roles_in_an_organization(organization_id, options)
92
+ end
93
+
94
+ def self.list_failed_organization_invitations(org: nil, options: nil)
95
+ new.list_failed_organization_invitations(org, options)
96
+ end
97
+
98
+ def self.list_pending_organization_invitations(org: nil, options: nil)
99
+ new.list_pending_organization_invitations(org, options)
100
+ end
101
+
102
+ def self.create_an_organization_invitation(org: nil, invitee_id: nil, email: nil, role: nil, team_ids: nil, options: nil)
103
+ new.create_an_organization_invitation(org, invitee_id, email, role, team_ids, options)
104
+ end
105
+
106
+ def self.cancel_an_organization_invitation(org: nil, invitation_id: nil, options: nil)
107
+ new.cancel_an_organization_invitation(org, invitation_id, options)
108
+ end
109
+
110
+ def self.list_organization_invitation_teams(org: nil, invitation_id: nil, options: nil)
111
+ new.list_organization_invitation_teams(org, invitation_id, options)
112
+ end
113
+
114
+ def self.list_organization_members(org: nil, options: nil)
115
+ new.list_organization_members(org, options)
116
+ end
117
+
118
+ def self.check_organization_membership_for_a_user(org: nil, username: nil, options: nil)
119
+ new.check_organization_membership_for_a_user(org, username, options)
120
+ end
121
+
122
+ def self.remove_an_organization_member(org: nil, username: nil, options: nil)
123
+ new.remove_an_organization_member(org, username, options)
124
+ end
125
+
126
+ def self.get_organization_membership_for_a_user(org: nil, username: nil, options: nil)
127
+ new.get_organization_membership_for_a_user(org, username, options)
128
+ end
129
+
130
+ def self.set_organization_membership_for_a_user(org: nil, username: nil, role: nil, options: nil)
131
+ new.set_organization_membership_for_a_user(org, username, role, options)
132
+ end
133
+
134
+ def self.remove_organization_membership_for_a_user(org: nil, username: nil, options: nil)
135
+ new.remove_organization_membership_for_a_user(org, username, options)
136
+ end
137
+
138
+ def self.list_public_organization_members(org: nil, options: nil)
139
+ new.list_public_organization_members(org, options)
140
+ end
141
+
142
+ def self.check_public_organization_membership_for_a_user(org: nil, username: nil, options: nil)
143
+ new.check_public_organization_membership_for_a_user(org, username, options)
144
+ end
145
+
146
+ def self.set_public_organization_membership_for_the_authenticated_user(org: nil, username: nil, options: nil)
147
+ new.set_public_organization_membership_for_the_authenticated_user(org, username, options)
148
+ end
149
+
150
+ def self.remove_public_organization_membership_for_the_authenticated_user(org: nil, username: nil, options: nil)
151
+ new.remove_public_organization_membership_for_the_authenticated_user(org, username, options)
152
+ end
153
+
154
+ def self.list_organization_memberships_for_the_authenticated_user(options: nil)
155
+ new.list_organization_memberships_for_the_authenticated_user(options)
156
+ end
157
+
158
+ def self.get_an_organization_membership_for_the_authenticated_user(org: nil, options: nil)
159
+ new.get_an_organization_membership_for_the_authenticated_user(org, options)
160
+ end
161
+
162
+ def self.update_an_organization_membership_for_the_authenticated_user(org: nil, state: nil, options: nil)
163
+ new.update_an_organization_membership_for_the_authenticated_user(org, state, options)
164
+ end
165
+
166
+ def self.list_outside_collaborators_for_an_organization(org: nil, options: nil)
167
+ new.list_outside_collaborators_for_an_organization(org, options)
168
+ end
169
+
170
+ def self.convert_an_organization_member_to_outside_collaborator(org: nil, username: nil, options: nil)
171
+ new.convert_an_organization_member_to_outside_collaborator(org, username, options)
172
+ end
173
+
174
+ def self.remove_outside_collaborator_from_an_organization(org: nil, username: nil, options: nil)
175
+ new.remove_outside_collaborator_from_an_organization(org, username, options)
176
+ end
177
+
178
+ def self.list_organization_webhooks(org: nil, options: nil)
179
+ new.list_organization_webhooks(org, options)
180
+ end
181
+
182
+ def self.create_an_organization_webhook(org: nil, name: nil, config: nil, events: nil, active: nil, options: nil)
183
+ new.create_an_organization_webhook(org, name, config, events, active, options)
184
+ end
185
+
186
+ def self.get_an_organization_webhook(org: nil, hook_id: nil, options: nil)
187
+ new.get_an_organization_webhook(org, hook_id, options)
188
+ end
189
+
190
+ def self.update_an_organization_webhook(org: nil, hook_id: nil, config: nil, events: nil, active: nil, name: nil, options: nil)
191
+ new.update_an_organization_webhook(org, hook_id, config, events, active, name, options)
192
+ end
193
+
194
+ def self.delete_an_organization_webhook(org: nil, hook_id: nil, options: nil)
195
+ new.delete_an_organization_webhook(org, hook_id, options)
196
+ end
197
+
198
+ def self.get_a_webhook_configuration_for_an_organization(org: nil, hook_id: nil, options: nil)
199
+ new.get_a_webhook_configuration_for_an_organization(org, hook_id, options)
200
+ end
201
+
202
+ def self.update_a_webhook_configuration_for_an_organization(org: nil, hook_id: nil, url: nil, content_type: nil, secret: nil, insecure_ssl: nil, options: nil)
203
+ new.update_a_webhook_configuration_for_an_organization(org, hook_id, url, content_type, secret, insecure_ssl, options)
204
+ end
205
+
206
+ def self.list_deliveries_for_an_organization_webhook(org: nil, hook_id: nil, options: nil)
207
+ new.list_deliveries_for_an_organization_webhook(org, hook_id, options)
208
+ end
209
+
210
+ def self.get_a_webhook_delivery_for_an_organization_webhook(org: nil, hook_id: nil, delivery_id: nil, options: nil)
211
+ new.get_a_webhook_delivery_for_an_organization_webhook(org, hook_id, delivery_id, options)
212
+ end
213
+
214
+ def self.redeliver_a_delivery_for_an_organization_webhook(org: nil, hook_id: nil, delivery_id: nil, options: nil)
215
+ new.redeliver_a_delivery_for_an_organization_webhook(org, hook_id, delivery_id, options)
216
+ end
217
+
218
+ def self.ping_an_organization_webhook(org: nil, hook_id: nil, options: nil)
219
+ new.ping_an_organization_webhook(org, hook_id, options)
220
+ end
221
+
222
+ private
223
+
224
+ # list organizations
225
+ #
226
+ # @params options [Hash]
227
+ #
228
+ # @return OrgsResult, OrgsErrorResult
229
+ def list_organizations(options)
230
+ auth = nil
231
+ body = nil
232
+ headers = { accept: 'application/vnd.github.v3+json' }
233
+ params = { since: options[:since], per_page: options[:per_page] }
234
+ uri = "#{Gitabu::BASE_URL}/organizations"
235
+
236
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
237
+
238
+ if http_call.successful?
239
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
240
+ else
241
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
242
+ end
243
+ end
244
+
245
+ # get an organization
246
+ #
247
+ # @param org [String]
248
+ #
249
+ # @return OrgsResult, OrgsErrorResult
250
+ def get_an_organization(org, _options)
251
+ auth = nil
252
+ body = nil
253
+ headers = { accept: 'application/vnd.github.v3+json' }
254
+ params = nil
255
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}"
256
+
257
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
258
+
259
+ if http_call.successful?
260
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
261
+ else
262
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
263
+ end
264
+ end
265
+
266
+ # update an organization
267
+ #
268
+ # @param org [String]
269
+ # @param billing_email [String] Billing email address. This address is not publicized.
270
+ # @param company [String] The company name.
271
+ # @param email [String] The publicly visible email address.
272
+ # @param twitter_username [String] The Twitter username of the company.
273
+ # @param location [String] The location.
274
+ # @param name [String] The shorthand name of the company.
275
+ # @param description [String] The description of the company.
276
+ # @param has_organization_projects [Boolean] Toggles whether an organization can use organization projects.
277
+ # @param has_repository_projects [Boolean] Toggles whether repositories that belong to the organization can use repository projects.
278
+ # @param default_repository_permission [String] Default permission level members have for organization repositories:
279
+ # * read - can pull, but not push to or administer this repository.
280
+ # * write - can pull and push, but not administer this repository.
281
+ # * admin - can pull, push, and administer this repository.
282
+ # * none - no permissions granted by default.Default: read
283
+ # @param members_can_create_repositories [Boolean] Toggles the ability of non-admin organization members to create repositories. Can be one of:
284
+ # * true - all organization members can create repositories.
285
+ # * false - only organization owners can create repositories.
286
+ # Default: true
287
+ # Note: A parameter can override this parameter. See members_allowed_repository_creation_type in this table for details. Note: A parameter can override this parameter. See members_allowed_repository_creation_type in this table for details.Default:
288
+ # @param members_can_create_internal_repositories [Boolean] Toggles whether organization members can create internal repositories, which are visible to all enterprise members. You can only allow members to create internal repositories if your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. Can be one of:
289
+ # * true - all organization members can create internal repositories.
290
+ # * false - only organization owners can create internal repositories.
291
+ # Default: true. For more information, see "Restricting repository creation in your organization" in the GitHub Help documentation.
292
+ # @param members_can_create_private_repositories [Boolean] Toggles whether organization members can create private repositories, which are visible to organization members with permission. Can be one of:
293
+ # * true - all organization members can create private repositories.
294
+ # * false - only organization owners can create private repositories.
295
+ # Default: true. For more information, see "Restricting repository creation in your organization" in the GitHub Help documentation.
296
+ # @param members_can_create_public_repositories [Boolean] Toggles whether organization members can create public repositories, which are visible to anyone. Can be one of:
297
+ # * true - all organization members can create public repositories.
298
+ # * false - only organization owners can create public repositories.
299
+ # Default: true. For more information, see "Restricting repository creation in your organization" in the GitHub Help documentation.
300
+ # @param members_allowed_repository_creation_type [String] Specifies which types of repositories non-admin organization members can create. Can be one of:
301
+ # * all - all organization members can create public and private repositories.
302
+ # * private - members can create private repositories. This option is only available to repositories that are part of an organization on GitHub Enterprise Cloud.
303
+ # * none - only admin members can create repositories.
304
+ # Note: This parameter is deprecated and will be removed in the future. Its return value ignores internal repositories. Using this parameter overrides values set in members_can_create_repositories. See the parameter deprecation notice in the operation description for details.
305
+ # @param members_can_create_pages [Boolean] Toggles whether organization members can create GitHub Pages sites. Can be one of:
306
+ # * true - all organization members can create GitHub Pages sites.
307
+ # * false - no organization members can create GitHub Pages sites. Existing published sites will not be impacted.Default:
308
+ # @param members_can_create_public_pages [Boolean] Toggles whether organization members can create public GitHub Pages sites. Can be one of:
309
+ # * true - all organization members can create public GitHub Pages sites.
310
+ # * false - no organization members can create public GitHub Pages sites. Existing published sites will not be impacted.Default:
311
+ # @param members_can_create_private_pages [Boolean] Toggles whether organization members can create private GitHub Pages sites. Can be one of:
312
+ # * true - all organization members can create private GitHub Pages sites.
313
+ # * false - no organization members can create private GitHub Pages sites. Existing published sites will not be impacted.Default:
314
+ # @param members_can_fork_private_repositories [Boolean] Toggles whether organization members can fork private organization repositories. Can be one of:
315
+ # * true - all organization members can fork private repositories within the organization.
316
+ # * false - no organization members can fork private repositories within the organization.
317
+ # @param blog [String]
318
+ #
319
+ # @return OrgsResult, OrgsErrorResult
320
+ def update_an_organization(org, billing_email, company, email, twitter_username, location, name, description, has_organization_projects, has_repository_projects, default_repository_permission, members_can_create_repositories, members_can_create_internal_repositories, members_can_create_private_repositories, members_can_create_public_repositories, members_allowed_repository_creation_type, members_can_create_pages, members_can_create_public_pages, members_can_create_private_pages, members_can_fork_private_repositories, blog, _options)
321
+ auth = nil
322
+ body = { billing_email: billing_email, company: company, email: email, twitter_username: twitter_username, location: location, name: name, description: description, has_organization_projects: has_organization_projects, has_repository_projects: has_repository_projects, default_repository_permission: default_repository_permission, members_can_create_repositories: members_can_create_repositories, members_can_create_internal_repositories: members_can_create_internal_repositories, members_can_create_private_repositories: members_can_create_private_repositories, members_can_create_public_repositories: members_can_create_public_repositories, members_allowed_repository_creation_type: members_allowed_repository_creation_type, members_can_create_pages: members_can_create_pages, members_can_create_public_pages: members_can_create_public_pages, members_can_create_private_pages: members_can_create_private_pages, members_can_fork_private_repositories: members_can_fork_private_repositories, blog: blog }
323
+ headers = { accept: 'application/vnd.github.v3+json' }
324
+ params = nil
325
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}"
326
+
327
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
328
+
329
+ if http_call.successful?
330
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
331
+ else
332
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
333
+ end
334
+ end
335
+
336
+ # get the audit log for an organization
337
+ #
338
+ # @param org [String]
339
+ #
340
+ # @return OrgsResult, OrgsErrorResult
341
+ def get_the_audit_log_for_an_organization(org, options)
342
+ auth = nil
343
+ body = nil
344
+ headers = { accept: 'application/vnd.github.v3+json' }
345
+ params = { phrase: options[:phrase], include: options[:include], after: options[:after], before: options[:before], order: options[:order], per_page: options[:per_page] }
346
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/audit-log"
347
+
348
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
349
+
350
+ if http_call.successful?
351
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
352
+ else
353
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
354
+ end
355
+ end
356
+
357
+ # list saml sso authorizations for an organization
358
+ #
359
+ # @param org [String]
360
+ #
361
+ # @return OrgsResult, OrgsErrorResult
362
+ def list_saml_sso_authorizations_for_an_organization(org, options)
363
+ auth = nil
364
+ body = nil
365
+ headers = { accept: 'application/vnd.github.v3+json' }
366
+ params = { per_page: options[:per_page], page: options[:page], login: options[:login] }
367
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/credential-authorizations"
368
+
369
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
370
+
371
+ if http_call.successful?
372
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
373
+ else
374
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
375
+ end
376
+ end
377
+
378
+ # remove a saml sso authorization for an organization
379
+ #
380
+ # @param org [String]
381
+ # @param credential_id [Integer]
382
+ #
383
+ # @return OrgsResult, OrgsErrorResult
384
+ def remove_a_saml_sso_authorization_for_an_organization(org, credential_id, _options)
385
+ auth = nil
386
+ body = nil
387
+ headers = { accept: 'application/vnd.github.v3+json' }
388
+ params = nil
389
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/credential-authorizations/#{credential_id}"
390
+
391
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
392
+
393
+ if http_call.successful?
394
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
395
+ else
396
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
397
+ end
398
+ end
399
+
400
+ # list app installations for an organization
401
+ #
402
+ # @param org [String]
403
+ #
404
+ # @return OrgsResult, OrgsErrorResult
405
+ def list_app_installations_for_an_organization(org, options)
406
+ auth = nil
407
+ body = nil
408
+ headers = { accept: 'application/vnd.github.v3+json' }
409
+ params = { per_page: options[:per_page], page: options[:page] }
410
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/installations"
411
+
412
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
413
+
414
+ if http_call.successful?
415
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
416
+ else
417
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
418
+ end
419
+ end
420
+
421
+ # list organizations for the authenticated user
422
+ #
423
+ # @params options [Hash]
424
+ #
425
+ # @return OrgsResult, OrgsErrorResult
426
+ def list_organizations_for_the_authenticated_user(options)
427
+ auth = nil
428
+ body = nil
429
+ headers = { accept: 'application/vnd.github.v3+json' }
430
+ params = { per_page: options[:per_page], page: options[:page] }
431
+ uri = "#{Gitabu::BASE_URL}/user/orgs"
432
+
433
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
434
+
435
+ if http_call.successful?
436
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
437
+ else
438
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
439
+ end
440
+ end
441
+
442
+ # list organizations for a user
443
+ #
444
+ # @param username [String]
445
+ #
446
+ # @return OrgsResult, OrgsErrorResult
447
+ def list_organizations_for_a_user(username, options)
448
+ auth = nil
449
+ body = nil
450
+ headers = { accept: 'application/vnd.github.v3+json' }
451
+ params = { per_page: options[:per_page], page: options[:page] }
452
+ uri = "#{Gitabu::BASE_URL}/users/#{username}/orgs"
453
+
454
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
455
+
456
+ if http_call.successful?
457
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
458
+ else
459
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
460
+ end
461
+ end
462
+
463
+ # list users blocked by an organization
464
+ #
465
+ # @param org [String]
466
+ #
467
+ # @return OrgsResult, OrgsErrorResult
468
+ def list_users_blocked_by_an_organization(org, _options)
469
+ auth = nil
470
+ body = nil
471
+ headers = { accept: 'application/vnd.github.v3+json' }
472
+ params = nil
473
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/blocks"
474
+
475
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
476
+
477
+ if http_call.successful?
478
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
479
+ else
480
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
481
+ end
482
+ end
483
+
484
+ # check if a user is blocked by an organization
485
+ #
486
+ # @param org [String]
487
+ # @param username [String]
488
+ #
489
+ # @return OrgsResult, OrgsErrorResult
490
+ def check_if_a_user_is_blocked_by_an_organization(org, username, _options)
491
+ auth = nil
492
+ body = nil
493
+ headers = { accept: 'application/vnd.github.v3+json' }
494
+ params = nil
495
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/blocks/#{username}"
496
+
497
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
498
+
499
+ if http_call.successful?
500
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
501
+ else
502
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
503
+ end
504
+ end
505
+
506
+ # block a user from an organization
507
+ #
508
+ # @param org [String]
509
+ # @param username [String]
510
+ #
511
+ # @return OrgsResult, OrgsErrorResult
512
+ def block_a_user_from_an_organization(org, username, _options)
513
+ auth = nil
514
+ body = nil
515
+ headers = { accept: 'application/vnd.github.v3+json' }
516
+ params = nil
517
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/blocks/#{username}"
518
+
519
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
520
+
521
+ if http_call.successful?
522
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
523
+ else
524
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
525
+ end
526
+ end
527
+
528
+ # unblock a user from an organization
529
+ #
530
+ # @param org [String]
531
+ # @param username [String]
532
+ #
533
+ # @return OrgsResult, OrgsErrorResult
534
+ def unblock_a_user_from_an_organization(org, username, _options)
535
+ auth = nil
536
+ body = nil
537
+ headers = { accept: 'application/vnd.github.v3+json' }
538
+ params = nil
539
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/blocks/#{username}"
540
+
541
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
542
+
543
+ if http_call.successful?
544
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
545
+ else
546
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
547
+ end
548
+ end
549
+
550
+ # list custom repository roles in an organization
551
+ #
552
+ # @param organization_id [String]
553
+ #
554
+ # @return OrgsResult, OrgsErrorResult
555
+ def list_custom_repository_roles_in_an_organization(organization_id, _options)
556
+ auth = nil
557
+ body = nil
558
+ headers = { accept: 'application/vnd.github.v3+json' }
559
+ params = nil
560
+ uri = "#{Gitabu::BASE_URL}/organizations/#{organization_id}/custom_roles"
561
+
562
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
563
+
564
+ if http_call.successful?
565
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
566
+ else
567
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
568
+ end
569
+ end
570
+
571
+ # list failed organization invitations
572
+ #
573
+ # @param org [String]
574
+ #
575
+ # @return OrgsResult, OrgsErrorResult
576
+ def list_failed_organization_invitations(org, options)
577
+ auth = nil
578
+ body = nil
579
+ headers = { accept: 'application/vnd.github.v3+json' }
580
+ params = { per_page: options[:per_page], page: options[:page] }
581
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/failed_invitations"
582
+
583
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
584
+
585
+ if http_call.successful?
586
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
587
+ else
588
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
589
+ end
590
+ end
591
+
592
+ # list pending organization invitations
593
+ #
594
+ # @param org [String]
595
+ #
596
+ # @return OrgsResult, OrgsErrorResult
597
+ def list_pending_organization_invitations(org, options)
598
+ auth = nil
599
+ body = nil
600
+ headers = { accept: 'application/vnd.github.v3+json' }
601
+ params = { per_page: options[:per_page], page: options[:page] }
602
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/invitations"
603
+
604
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
605
+
606
+ if http_call.successful?
607
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
608
+ else
609
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
610
+ end
611
+ end
612
+
613
+ # create an organization invitation
614
+ #
615
+ # @param org [String]
616
+ # @param invitee_id [Integer] Required unless you provide email. GitHub user ID for the person you are inviting.
617
+ # @param email [String] Required unless you provide invitee_id. Email address of the person you are inviting, which can be an existing GitHub user.
618
+ # @param role [String] Specify role for new member. Can be one of:
619
+ # * admin - Organization owners with full administrative rights to the organization and complete access to all repositories and teams.
620
+ # * direct_member - Non-owner organization members with ability to see other members and join teams by invitation.
621
+ # * billing_manager - Non-owner organization members with ability to manage the billing settings of your organization.Default: direct_member
622
+ # @param team_ids [Array of integers] Specify IDs for the teams you want to invite new members to.
623
+ #
624
+ # @return OrgsResult, OrgsErrorResult
625
+ def create_an_organization_invitation(org, invitee_id, email, role, team_ids, _options)
626
+ auth = nil
627
+ body = { invitee_id: invitee_id, email: email, role: role, team_ids: team_ids }
628
+ headers = { accept: 'application/vnd.github.v3+json' }
629
+ params = nil
630
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/invitations"
631
+
632
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
633
+
634
+ if http_call.successful?
635
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
636
+ else
637
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
638
+ end
639
+ end
640
+
641
+ # cancel an organization invitation
642
+ #
643
+ # @param org [String]
644
+ # @param invitation_id [Integer] invitation_id parameter
645
+ #
646
+ # @return OrgsResult, OrgsErrorResult
647
+ def cancel_an_organization_invitation(org, invitation_id, _options)
648
+ auth = nil
649
+ body = nil
650
+ headers = { accept: 'application/vnd.github.v3+json' }
651
+ params = nil
652
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/invitations/#{invitation_id}"
653
+
654
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
655
+
656
+ if http_call.successful?
657
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
658
+ else
659
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
660
+ end
661
+ end
662
+
663
+ # list organization invitation teams
664
+ #
665
+ # @param org [String]
666
+ # @param invitation_id [Integer] invitation_id parameter
667
+ #
668
+ # @return OrgsResult, OrgsErrorResult
669
+ def list_organization_invitation_teams(org, invitation_id, options)
670
+ auth = nil
671
+ body = nil
672
+ headers = { accept: 'application/vnd.github.v3+json' }
673
+ params = { per_page: options[:per_page], page: options[:page] }
674
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/invitations/#{invitation_id}/teams"
675
+
676
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
677
+
678
+ if http_call.successful?
679
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
680
+ else
681
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
682
+ end
683
+ end
684
+
685
+ # list organization members
686
+ #
687
+ # @param org [String]
688
+ #
689
+ # @return OrgsResult, OrgsErrorResult
690
+ def list_organization_members(org, options)
691
+ auth = nil
692
+ body = nil
693
+ headers = { accept: 'application/vnd.github.v3+json' }
694
+ params = { filter: options[:filter], role: options[:role], per_page: options[:per_page], page: options[:page] }
695
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/members"
696
+
697
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
698
+
699
+ if http_call.successful?
700
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
701
+ else
702
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
703
+ end
704
+ end
705
+
706
+ # check organization membership for a user
707
+ #
708
+ # @param org [String]
709
+ # @param username [String]
710
+ #
711
+ # @return OrgsResult, OrgsErrorResult
712
+ def check_organization_membership_for_a_user(org, username, _options)
713
+ auth = nil
714
+ body = nil
715
+ headers = { accept: 'application/vnd.github.v3+json' }
716
+ params = nil
717
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/members/#{username}"
718
+
719
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
720
+
721
+ if http_call.successful?
722
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
723
+ else
724
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
725
+ end
726
+ end
727
+
728
+ # remove an organization member
729
+ #
730
+ # @param org [String]
731
+ # @param username [String]
732
+ #
733
+ # @return OrgsResult, OrgsErrorResult
734
+ def remove_an_organization_member(org, username, _options)
735
+ auth = nil
736
+ body = nil
737
+ headers = { accept: 'application/vnd.github.v3+json' }
738
+ params = nil
739
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/members/#{username}"
740
+
741
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
742
+
743
+ if http_call.successful?
744
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
745
+ else
746
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
747
+ end
748
+ end
749
+
750
+ # get organization membership for a user
751
+ #
752
+ # @param org [String]
753
+ # @param username [String]
754
+ #
755
+ # @return OrgsResult, OrgsErrorResult
756
+ def get_organization_membership_for_a_user(org, username, _options)
757
+ auth = nil
758
+ body = nil
759
+ headers = { accept: 'application/vnd.github.v3+json' }
760
+ params = nil
761
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/memberships/#{username}"
762
+
763
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
764
+
765
+ if http_call.successful?
766
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
767
+ else
768
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
769
+ end
770
+ end
771
+
772
+ # set organization membership for a user
773
+ #
774
+ # @param org [String]
775
+ # @param username [String]
776
+ # @param role [String] The role to give the user in the organization. Can be one of:
777
+ # * admin - The user will become an owner of the organization.
778
+ # * member - The user will become a non-owner member of the organization.Default: member
779
+ #
780
+ # @return OrgsResult, OrgsErrorResult
781
+ def set_organization_membership_for_a_user(org, username, role, _options)
782
+ auth = nil
783
+ body = { role: role }
784
+ headers = { accept: 'application/vnd.github.v3+json' }
785
+ params = nil
786
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/memberships/#{username}"
787
+
788
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
789
+
790
+ if http_call.successful?
791
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
792
+ else
793
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
794
+ end
795
+ end
796
+
797
+ # remove organization membership for a user
798
+ #
799
+ # @param org [String]
800
+ # @param username [String]
801
+ #
802
+ # @return OrgsResult, OrgsErrorResult
803
+ def remove_organization_membership_for_a_user(org, username, _options)
804
+ auth = nil
805
+ body = nil
806
+ headers = { accept: 'application/vnd.github.v3+json' }
807
+ params = nil
808
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/memberships/#{username}"
809
+
810
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
811
+
812
+ if http_call.successful?
813
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
814
+ else
815
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
816
+ end
817
+ end
818
+
819
+ # list public organization members
820
+ #
821
+ # @param org [String]
822
+ #
823
+ # @return OrgsResult, OrgsErrorResult
824
+ def list_public_organization_members(org, options)
825
+ auth = nil
826
+ body = nil
827
+ headers = { accept: 'application/vnd.github.v3+json' }
828
+ params = { per_page: options[:per_page], page: options[:page] }
829
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/public_members"
830
+
831
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
832
+
833
+ if http_call.successful?
834
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
835
+ else
836
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
837
+ end
838
+ end
839
+
840
+ # check public organization membership for a user
841
+ #
842
+ # @param org [String]
843
+ # @param username [String]
844
+ #
845
+ # @return OrgsResult, OrgsErrorResult
846
+ def check_public_organization_membership_for_a_user(org, username, _options)
847
+ auth = nil
848
+ body = nil
849
+ headers = { accept: 'application/vnd.github.v3+json' }
850
+ params = nil
851
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/public_members/#{username}"
852
+
853
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
854
+
855
+ if http_call.successful?
856
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
857
+ else
858
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
859
+ end
860
+ end
861
+
862
+ # set public organization membership for the authenticated user
863
+ #
864
+ # @param org [String]
865
+ # @param username [String]
866
+ #
867
+ # @return OrgsResult, OrgsErrorResult
868
+ def set_public_organization_membership_for_the_authenticated_user(org, username, _options)
869
+ auth = nil
870
+ body = nil
871
+ headers = { accept: 'application/vnd.github.v3+json' }
872
+ params = nil
873
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/public_members/#{username}"
874
+
875
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
876
+
877
+ if http_call.successful?
878
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
879
+ else
880
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
881
+ end
882
+ end
883
+
884
+ # remove public organization membership for the authenticated user
885
+ #
886
+ # @param org [String]
887
+ # @param username [String]
888
+ #
889
+ # @return OrgsResult, OrgsErrorResult
890
+ def remove_public_organization_membership_for_the_authenticated_user(org, username, _options)
891
+ auth = nil
892
+ body = nil
893
+ headers = { accept: 'application/vnd.github.v3+json' }
894
+ params = nil
895
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/public_members/#{username}"
896
+
897
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
898
+
899
+ if http_call.successful?
900
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
901
+ else
902
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
903
+ end
904
+ end
905
+
906
+ # list organization memberships for the authenticated user
907
+ #
908
+ # @params options [Hash]
909
+ #
910
+ # @return OrgsResult, OrgsErrorResult
911
+ def list_organization_memberships_for_the_authenticated_user(options)
912
+ auth = nil
913
+ body = nil
914
+ headers = { accept: 'application/vnd.github.v3+json' }
915
+ params = { state: options[:state], per_page: options[:per_page], page: options[:page] }
916
+ uri = "#{Gitabu::BASE_URL}/user/memberships/orgs"
917
+
918
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
919
+
920
+ if http_call.successful?
921
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
922
+ else
923
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
924
+ end
925
+ end
926
+
927
+ # get an organization membership for the authenticated user
928
+ #
929
+ # @param org [String]
930
+ #
931
+ # @return OrgsResult, OrgsErrorResult
932
+ def get_an_organization_membership_for_the_authenticated_user(org, _options)
933
+ auth = nil
934
+ body = nil
935
+ headers = { accept: 'application/vnd.github.v3+json' }
936
+ params = nil
937
+ uri = "#{Gitabu::BASE_URL}/user/memberships/orgs/#{org}"
938
+
939
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
940
+
941
+ if http_call.successful?
942
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
943
+ else
944
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
945
+ end
946
+ end
947
+
948
+ # update an organization membership for the authenticated user
949
+ #
950
+ # @param org [String]
951
+ # @param state [String] Required. The state that the membership should be in. Only "active" will be accepted.
952
+ #
953
+ # @return OrgsResult, OrgsErrorResult
954
+ def update_an_organization_membership_for_the_authenticated_user(org, state, _options)
955
+ auth = nil
956
+ body = { state: state }
957
+ headers = { accept: 'application/vnd.github.v3+json' }
958
+ params = nil
959
+ uri = "#{Gitabu::BASE_URL}/user/memberships/orgs/#{org}"
960
+
961
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
962
+
963
+ if http_call.successful?
964
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
965
+ else
966
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
967
+ end
968
+ end
969
+
970
+ # list outside collaborators for an organization
971
+ #
972
+ # @param org [String]
973
+ #
974
+ # @return OrgsResult, OrgsErrorResult
975
+ def list_outside_collaborators_for_an_organization(org, options)
976
+ auth = nil
977
+ body = nil
978
+ headers = { accept: 'application/vnd.github.v3+json' }
979
+ params = { filter: options[:filter], per_page: options[:per_page], page: options[:page] }
980
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/outside_collaborators"
981
+
982
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
983
+
984
+ if http_call.successful?
985
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
986
+ else
987
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
988
+ end
989
+ end
990
+
991
+ # convert an organization member to outside collaborator
992
+ #
993
+ # @param org [String]
994
+ # @param username [String]
995
+ #
996
+ # @return OrgsResult, OrgsErrorResult
997
+ def convert_an_organization_member_to_outside_collaborator(org, username, _options)
998
+ auth = nil
999
+ body = nil
1000
+ headers = { accept: 'application/vnd.github.v3+json' }
1001
+ params = nil
1002
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/outside_collaborators/#{username}"
1003
+
1004
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
1005
+
1006
+ if http_call.successful?
1007
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1008
+ else
1009
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1010
+ end
1011
+ end
1012
+
1013
+ # remove outside collaborator from an organization
1014
+ #
1015
+ # @param org [String]
1016
+ # @param username [String]
1017
+ #
1018
+ # @return OrgsResult, OrgsErrorResult
1019
+ def remove_outside_collaborator_from_an_organization(org, username, _options)
1020
+ auth = nil
1021
+ body = nil
1022
+ headers = { accept: 'application/vnd.github.v3+json' }
1023
+ params = nil
1024
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/outside_collaborators/#{username}"
1025
+
1026
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
1027
+
1028
+ if http_call.successful?
1029
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1030
+ else
1031
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1032
+ end
1033
+ end
1034
+
1035
+ # list organization webhooks
1036
+ #
1037
+ # @param org [String]
1038
+ #
1039
+ # @return OrgsResult, OrgsErrorResult
1040
+ def list_organization_webhooks(org, options)
1041
+ auth = nil
1042
+ body = nil
1043
+ headers = { accept: 'application/vnd.github.v3+json' }
1044
+ params = { per_page: options[:per_page], page: options[:page] }
1045
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/hooks"
1046
+
1047
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1048
+
1049
+ if http_call.successful?
1050
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1051
+ else
1052
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1053
+ end
1054
+ end
1055
+
1056
+ # create an organization webhook
1057
+ #
1058
+ # @param org [String]
1059
+ # @param name [String] Required. Must be passed as "web".
1060
+ # @param config [Object] Required. Key/value pairs to provide settings for this webhook. These are defined below.
1061
+ # @param events [Array of strings] Determines what events the hook is triggered for.Default: push
1062
+ # @param active [Boolean] Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.Default:
1063
+ #
1064
+ # @return OrgsResult, OrgsErrorResult
1065
+ def create_an_organization_webhook(org, name, config, events, active, _options)
1066
+ auth = nil
1067
+ body = { name: name, config: config, events: events, active: active }
1068
+ headers = { accept: 'application/vnd.github.v3+json' }
1069
+ params = nil
1070
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/hooks"
1071
+
1072
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
1073
+
1074
+ if http_call.successful?
1075
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1076
+ else
1077
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1078
+ end
1079
+ end
1080
+
1081
+ # get an organization webhook
1082
+ #
1083
+ # @param org [String]
1084
+ # @param hook_id [Integer]
1085
+ #
1086
+ # @return OrgsResult, OrgsErrorResult
1087
+ def get_an_organization_webhook(org, hook_id, _options)
1088
+ auth = nil
1089
+ body = nil
1090
+ headers = { accept: 'application/vnd.github.v3+json' }
1091
+ params = nil
1092
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/hooks/#{hook_id}"
1093
+
1094
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1095
+
1096
+ if http_call.successful?
1097
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1098
+ else
1099
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1100
+ end
1101
+ end
1102
+
1103
+ # update an organization webhook
1104
+ #
1105
+ # @param org [String]
1106
+ # @param hook_id [Integer]
1107
+ # @param config [Object] Key/value pairs to provide settings for this webhook. These are defined below.
1108
+ # @param events [Array of strings] Determines what events the hook is triggered for.Default: push
1109
+ # @param active [Boolean] Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.Default:
1110
+ # @param name [String]
1111
+ #
1112
+ # @return OrgsResult, OrgsErrorResult
1113
+ def update_an_organization_webhook(org, hook_id, config, events, active, name, _options)
1114
+ auth = nil
1115
+ body = { config: config, events: events, active: active, name: name }
1116
+ headers = { accept: 'application/vnd.github.v3+json' }
1117
+ params = nil
1118
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/hooks/#{hook_id}"
1119
+
1120
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
1121
+
1122
+ if http_call.successful?
1123
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1124
+ else
1125
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1126
+ end
1127
+ end
1128
+
1129
+ # delete an organization webhook
1130
+ #
1131
+ # @param org [String]
1132
+ # @param hook_id [Integer]
1133
+ #
1134
+ # @return OrgsResult, OrgsErrorResult
1135
+ def delete_an_organization_webhook(org, hook_id, _options)
1136
+ auth = nil
1137
+ body = nil
1138
+ headers = { accept: 'application/vnd.github.v3+json' }
1139
+ params = nil
1140
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/hooks/#{hook_id}"
1141
+
1142
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
1143
+
1144
+ if http_call.successful?
1145
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1146
+ else
1147
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1148
+ end
1149
+ end
1150
+
1151
+ # get a webhook configuration for an organization
1152
+ #
1153
+ # @param org [String]
1154
+ # @param hook_id [Integer]
1155
+ #
1156
+ # @return OrgsResult, OrgsErrorResult
1157
+ def get_a_webhook_configuration_for_an_organization(org, hook_id, _options)
1158
+ auth = nil
1159
+ body = nil
1160
+ headers = { accept: 'application/vnd.github.v3+json' }
1161
+ params = nil
1162
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/hooks/#{hook_id}/config"
1163
+
1164
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1165
+
1166
+ if http_call.successful?
1167
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1168
+ else
1169
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1170
+ end
1171
+ end
1172
+
1173
+ # update a webhook configuration for an organization
1174
+ #
1175
+ # @param org [String]
1176
+ # @param hook_id [Integer]
1177
+ # @param url [String] The URL to which the payloads will be delivered.
1178
+ # @param content_type [String] The media type used to serialize the payloads. Supported values include json and form. The default is form.
1179
+ # @param secret [String] If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers.
1180
+ # @param insecure_ssl [String or number or ] Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Supported values include 0 (verification is performed) and 1 (verification is not performed). The default is 0. We strongly recommend not setting this to 1 as you are subject to man-in-the-middle and other attacks.
1181
+ #
1182
+ # @return OrgsResult, OrgsErrorResult
1183
+ def update_a_webhook_configuration_for_an_organization(org, hook_id, url, content_type, secret, insecure_ssl, _options)
1184
+ auth = nil
1185
+ body = { url: url, content_type: content_type, secret: secret, insecure_ssl: insecure_ssl }
1186
+ headers = { accept: 'application/vnd.github.v3+json' }
1187
+ params = nil
1188
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/hooks/#{hook_id}/config"
1189
+
1190
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
1191
+
1192
+ if http_call.successful?
1193
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1194
+ else
1195
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1196
+ end
1197
+ end
1198
+
1199
+ # list deliveries for an organization webhook
1200
+ #
1201
+ # @param org [String]
1202
+ # @param hook_id [Integer]
1203
+ #
1204
+ # @return OrgsResult, OrgsErrorResult
1205
+ def list_deliveries_for_an_organization_webhook(org, hook_id, options)
1206
+ auth = nil
1207
+ body = nil
1208
+ headers = { accept: 'application/vnd.github.v3+json' }
1209
+ params = { per_page: options[:per_page], cursor: options[:cursor] }
1210
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/hooks/#{hook_id}/deliveries"
1211
+
1212
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1213
+
1214
+ if http_call.successful?
1215
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1216
+ else
1217
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1218
+ end
1219
+ end
1220
+
1221
+ # get a webhook delivery for an organization webhook
1222
+ #
1223
+ # @param org [String]
1224
+ # @param hook_id [Integer]
1225
+ # @param delivery_id [Integer]
1226
+ #
1227
+ # @return OrgsResult, OrgsErrorResult
1228
+ def get_a_webhook_delivery_for_an_organization_webhook(org, hook_id, delivery_id, _options)
1229
+ auth = nil
1230
+ body = nil
1231
+ headers = { accept: 'application/vnd.github.v3+json' }
1232
+ params = nil
1233
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/hooks/#{hook_id}/deliveries/#{delivery_id}"
1234
+
1235
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1236
+
1237
+ if http_call.successful?
1238
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1239
+ else
1240
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1241
+ end
1242
+ end
1243
+
1244
+ # redeliver a delivery for an organization webhook
1245
+ #
1246
+ # @param org [String]
1247
+ # @param hook_id [Integer]
1248
+ # @param delivery_id [Integer]
1249
+ #
1250
+ # @return OrgsResult, OrgsErrorResult
1251
+ def redeliver_a_delivery_for_an_organization_webhook(org, hook_id, delivery_id, _options)
1252
+ auth = nil
1253
+ body = nil
1254
+ headers = { accept: 'application/vnd.github.v3+json' }
1255
+ params = nil
1256
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/hooks/#{hook_id}/deliveries/#{delivery_id}/attempts"
1257
+
1258
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
1259
+
1260
+ if http_call.successful?
1261
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1262
+ else
1263
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1264
+ end
1265
+ end
1266
+
1267
+ # ping an organization webhook
1268
+ #
1269
+ # @param org [String]
1270
+ # @param hook_id [Integer]
1271
+ #
1272
+ # @return OrgsResult, OrgsErrorResult
1273
+ def ping_an_organization_webhook(org, hook_id, _options)
1274
+ auth = nil
1275
+ body = nil
1276
+ headers = { accept: 'application/vnd.github.v3+json' }
1277
+ params = nil
1278
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/hooks/#{hook_id}/pings"
1279
+
1280
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
1281
+
1282
+ if http_call.successful?
1283
+ OrgsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1284
+ else
1285
+ OrgsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1286
+ end
1287
+ end
1288
+ end
1289
+ end
1290
+ end
1291
+ end