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,1963 @@
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 Teams result
17
+ class TeamsResult
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 TeamsErrorResult
28
+ attr_accessor :result, :message
29
+
30
+ def initialize(result:, message:)
31
+ @result = result
32
+ @message = message
33
+ end
34
+ end
35
+
36
+ # Teams endpoints.
37
+ class Teams
38
+ def self.list_teams(org: nil, options: nil)
39
+ new.list_teams(org, options)
40
+ end
41
+
42
+ def self.create_a_team(org: nil, name: nil, description: nil, maintainers: nil, repo_names: nil, privacy: nil, permission: nil, parent_team_id: nil, options: nil)
43
+ new.create_a_team(org, name, description, maintainers, repo_names, privacy, permission, parent_team_id, options)
44
+ end
45
+
46
+ def self.get_a_team_by_name(org: nil, team_slug: nil, options: nil)
47
+ new.get_a_team_by_name(org, team_slug, options)
48
+ end
49
+
50
+ def self.update_a_team(org: nil, team_slug: nil, name: nil, description: nil, privacy: nil, permission: nil, parent_team_id: nil, options: nil)
51
+ new.update_a_team(org, team_slug, name, description, privacy, permission, parent_team_id, options)
52
+ end
53
+
54
+ def self.delete_a_team(org: nil, team_slug: nil, options: nil)
55
+ new.delete_a_team(org, team_slug, options)
56
+ end
57
+
58
+ def self.list_team_projects(org: nil, team_slug: nil, options: nil)
59
+ new.list_team_projects(org, team_slug, options)
60
+ end
61
+
62
+ def self.check_team_permissions_for_a_project(org: nil, team_slug: nil, project_id: nil, options: nil)
63
+ new.check_team_permissions_for_a_project(org, team_slug, project_id, options)
64
+ end
65
+
66
+ def self.add_or_update_team_project_permissions(org: nil, team_slug: nil, project_id: nil, permission: nil, options: nil)
67
+ new.add_or_update_team_project_permissions(org, team_slug, project_id, permission, options)
68
+ end
69
+
70
+ def self.remove_a_project_from_a_team(org: nil, team_slug: nil, project_id: nil, options: nil)
71
+ new.remove_a_project_from_a_team(org, team_slug, project_id, options)
72
+ end
73
+
74
+ def self.list_team_repositories(org: nil, team_slug: nil, options: nil)
75
+ new.list_team_repositories(org, team_slug, options)
76
+ end
77
+
78
+ def self.check_team_permissions_for_a_repository(org: nil, team_slug: nil, owner: nil, repo: nil, options: nil)
79
+ new.check_team_permissions_for_a_repository(org, team_slug, owner, repo, options)
80
+ end
81
+
82
+ def self.add_or_update_team_repository_permissions(org: nil, team_slug: nil, owner: nil, repo: nil, permission: nil, options: nil)
83
+ new.add_or_update_team_repository_permissions(org, team_slug, owner, repo, permission, options)
84
+ end
85
+
86
+ def self.remove_a_repository_from_a_team(org: nil, team_slug: nil, owner: nil, repo: nil, options: nil)
87
+ new.remove_a_repository_from_a_team(org, team_slug, owner, repo, options)
88
+ end
89
+
90
+ def self.list_child_teams(org: nil, team_slug: nil, options: nil)
91
+ new.list_child_teams(org, team_slug, options)
92
+ end
93
+
94
+ def self.get_a_team_legacy(team_id: nil, options: nil)
95
+ new.get_a_team_legacy(team_id, options)
96
+ end
97
+
98
+ def self.update_a_team_legacy(team_id: nil, name: nil, description: nil, privacy: nil, permission: nil, parent_team_id: nil, options: nil)
99
+ new.update_a_team_legacy(team_id, name, description, privacy, permission, parent_team_id, options)
100
+ end
101
+
102
+ def self.delete_a_team_legacy(team_id: nil, options: nil)
103
+ new.delete_a_team_legacy(team_id, options)
104
+ end
105
+
106
+ def self.list_team_projects_legacy(team_id: nil, options: nil)
107
+ new.list_team_projects_legacy(team_id, options)
108
+ end
109
+
110
+ def self.check_team_permissions_for_a_project_legacy(team_id: nil, project_id: nil, options: nil)
111
+ new.check_team_permissions_for_a_project_legacy(team_id, project_id, options)
112
+ end
113
+
114
+ def self.add_or_update_team_project_permissions_legacy(team_id: nil, project_id: nil, permission: nil, options: nil)
115
+ new.add_or_update_team_project_permissions_legacy(team_id, project_id, permission, options)
116
+ end
117
+
118
+ def self.remove_a_project_from_a_team_legacy(team_id: nil, project_id: nil, options: nil)
119
+ new.remove_a_project_from_a_team_legacy(team_id, project_id, options)
120
+ end
121
+
122
+ def self.list_team_repositories_legacy(team_id: nil, options: nil)
123
+ new.list_team_repositories_legacy(team_id, options)
124
+ end
125
+
126
+ def self.check_team_permissions_for_a_repository_legacy(team_id: nil, owner: nil, repo: nil, options: nil)
127
+ new.check_team_permissions_for_a_repository_legacy(team_id, owner, repo, options)
128
+ end
129
+
130
+ def self.add_or_update_team_repository_permissions_legacy(team_id: nil, owner: nil, repo: nil, permission: nil, options: nil)
131
+ new.add_or_update_team_repository_permissions_legacy(team_id, owner, repo, permission, options)
132
+ end
133
+
134
+ def self.remove_a_repository_from_a_team_legacy(team_id: nil, owner: nil, repo: nil, options: nil)
135
+ new.remove_a_repository_from_a_team_legacy(team_id, owner, repo, options)
136
+ end
137
+
138
+ def self.list_child_teams_legacy(team_id: nil, options: nil)
139
+ new.list_child_teams_legacy(team_id, options)
140
+ end
141
+
142
+ def self.list_teams_for_the_authenticated_user(options: nil)
143
+ new.list_teams_for_the_authenticated_user(options)
144
+ end
145
+
146
+ def self.list_discussion_comments(org: nil, team_slug: nil, discussion_number: nil, options: nil)
147
+ new.list_discussion_comments(org, team_slug, discussion_number, options)
148
+ end
149
+
150
+ def self.create_a_discussion_comment(org: nil, team_slug: nil, discussion_number: nil, body: nil, options: nil)
151
+ new.create_a_discussion_comment(org, team_slug, discussion_number, body, options)
152
+ end
153
+
154
+ def self.get_a_discussion_comment(org: nil, team_slug: nil, discussion_number: nil, comment_number: nil, options: nil)
155
+ new.get_a_discussion_comment(org, team_slug, discussion_number, comment_number, options)
156
+ end
157
+
158
+ def self.update_a_discussion_comment(org: nil, team_slug: nil, discussion_number: nil, comment_number: nil, body: nil, options: nil)
159
+ new.update_a_discussion_comment(org, team_slug, discussion_number, comment_number, body, options)
160
+ end
161
+
162
+ def self.delete_a_discussion_comment(org: nil, team_slug: nil, discussion_number: nil, comment_number: nil, options: nil)
163
+ new.delete_a_discussion_comment(org, team_slug, discussion_number, comment_number, options)
164
+ end
165
+
166
+ def self.list_discussion_comments_legacy(team_id: nil, discussion_number: nil, options: nil)
167
+ new.list_discussion_comments_legacy(team_id, discussion_number, options)
168
+ end
169
+
170
+ def self.create_a_discussion_comment_legacy(team_id: nil, discussion_number: nil, body: nil, options: nil)
171
+ new.create_a_discussion_comment_legacy(team_id, discussion_number, body, options)
172
+ end
173
+
174
+ def self.get_a_discussion_comment_legacy(team_id: nil, discussion_number: nil, comment_number: nil, options: nil)
175
+ new.get_a_discussion_comment_legacy(team_id, discussion_number, comment_number, options)
176
+ end
177
+
178
+ def self.update_a_discussion_comment_legacy(team_id: nil, discussion_number: nil, comment_number: nil, body: nil, options: nil)
179
+ new.update_a_discussion_comment_legacy(team_id, discussion_number, comment_number, body, options)
180
+ end
181
+
182
+ def self.delete_a_discussion_comment_legacy(team_id: nil, discussion_number: nil, comment_number: nil, options: nil)
183
+ new.delete_a_discussion_comment_legacy(team_id, discussion_number, comment_number, options)
184
+ end
185
+
186
+ def self.list_discussions(org: nil, team_slug: nil, options: nil)
187
+ new.list_discussions(org, team_slug, options)
188
+ end
189
+
190
+ def self.create_a_discussion(org: nil, team_slug: nil, title: nil, body: nil, private: nil, options: nil)
191
+ new.create_a_discussion(org, team_slug, title, body, private, options)
192
+ end
193
+
194
+ def self.get_a_discussion(org: nil, team_slug: nil, discussion_number: nil, options: nil)
195
+ new.get_a_discussion(org, team_slug, discussion_number, options)
196
+ end
197
+
198
+ def self.update_a_discussion(org: nil, team_slug: nil, discussion_number: nil, title: nil, body: nil, options: nil)
199
+ new.update_a_discussion(org, team_slug, discussion_number, title, body, options)
200
+ end
201
+
202
+ def self.delete_a_discussion(org: nil, team_slug: nil, discussion_number: nil, options: nil)
203
+ new.delete_a_discussion(org, team_slug, discussion_number, options)
204
+ end
205
+
206
+ def self.list_discussions_legacy(team_id: nil, options: nil)
207
+ new.list_discussions_legacy(team_id, options)
208
+ end
209
+
210
+ def self.create_a_discussion_legacy(team_id: nil, title: nil, body: nil, private: nil, options: nil)
211
+ new.create_a_discussion_legacy(team_id, title, body, private, options)
212
+ end
213
+
214
+ def self.get_a_discussion_legacy(team_id: nil, discussion_number: nil, options: nil)
215
+ new.get_a_discussion_legacy(team_id, discussion_number, options)
216
+ end
217
+
218
+ def self.update_a_discussion_legacy(team_id: nil, discussion_number: nil, title: nil, body: nil, options: nil)
219
+ new.update_a_discussion_legacy(team_id, discussion_number, title, body, options)
220
+ end
221
+
222
+ def self.delete_a_discussion_legacy(team_id: nil, discussion_number: nil, options: nil)
223
+ new.delete_a_discussion_legacy(team_id, discussion_number, options)
224
+ end
225
+
226
+ def self.get_an_external_group(org: nil, group_id: nil, options: nil)
227
+ new.get_an_external_group(org, group_id, options)
228
+ end
229
+
230
+ def self.list_external_groups_in_an_organization(org: nil, options: nil)
231
+ new.list_external_groups_in_an_organization(org, options)
232
+ end
233
+
234
+ def self.list_a_connection_between_an_external_group_and_a_team(org: nil, team_slug: nil, options: nil)
235
+ new.list_a_connection_between_an_external_group_and_a_team(org, team_slug, options)
236
+ end
237
+
238
+ def self.update_the_connection_between_an_external_group_and_a_team(org: nil, team_slug: nil, group_id: nil, options: nil)
239
+ new.update_the_connection_between_an_external_group_and_a_team(org, team_slug, group_id, options)
240
+ end
241
+
242
+ def self.remove_the_connection_between_an_external_group_and_a_team(org: nil, team_slug: nil, options: nil)
243
+ new.remove_the_connection_between_an_external_group_and_a_team(org, team_slug, options)
244
+ end
245
+
246
+ def self.list_pending_team_invitations(org: nil, team_slug: nil, options: nil)
247
+ new.list_pending_team_invitations(org, team_slug, options)
248
+ end
249
+
250
+ def self.list_team_members(org: nil, team_slug: nil, options: nil)
251
+ new.list_team_members(org, team_slug, options)
252
+ end
253
+
254
+ def self.get_team_membership_for_a_user(org: nil, team_slug: nil, username: nil, options: nil)
255
+ new.get_team_membership_for_a_user(org, team_slug, username, options)
256
+ end
257
+
258
+ def self.add_or_update_team_membership_for_a_user(org: nil, team_slug: nil, username: nil, role: nil, options: nil)
259
+ new.add_or_update_team_membership_for_a_user(org, team_slug, username, role, options)
260
+ end
261
+
262
+ def self.remove_team_membership_for_a_user(org: nil, team_slug: nil, username: nil, options: nil)
263
+ new.remove_team_membership_for_a_user(org, team_slug, username, options)
264
+ end
265
+
266
+ def self.list_pending_team_invitations_legacy(team_id: nil, options: nil)
267
+ new.list_pending_team_invitations_legacy(team_id, options)
268
+ end
269
+
270
+ def self.list_team_members_legacy(team_id: nil, options: nil)
271
+ new.list_team_members_legacy(team_id, options)
272
+ end
273
+
274
+ def self.get_team_member_legacy(team_id: nil, username: nil, options: nil)
275
+ new.get_team_member_legacy(team_id, username, options)
276
+ end
277
+
278
+ def self.add_team_member_legacy(team_id: nil, username: nil, options: nil)
279
+ new.add_team_member_legacy(team_id, username, options)
280
+ end
281
+
282
+ def self.remove_team_member_legacy(team_id: nil, username: nil, options: nil)
283
+ new.remove_team_member_legacy(team_id, username, options)
284
+ end
285
+
286
+ def self.get_team_membership_for_a_user_legacy(team_id: nil, username: nil, options: nil)
287
+ new.get_team_membership_for_a_user_legacy(team_id, username, options)
288
+ end
289
+
290
+ def self.add_or_update_team_membership_for_a_user_legacy(team_id: nil, username: nil, role: nil, options: nil)
291
+ new.add_or_update_team_membership_for_a_user_legacy(team_id, username, role, options)
292
+ end
293
+
294
+ def self.remove_team_membership_for_a_user_legacy(team_id: nil, username: nil, options: nil)
295
+ new.remove_team_membership_for_a_user_legacy(team_id, username, options)
296
+ end
297
+
298
+ def self.list_idp_groups_for_an_organization(org: nil, options: nil)
299
+ new.list_idp_groups_for_an_organization(org, options)
300
+ end
301
+
302
+ def self.list_idp_groups_for_a_team(org: nil, team_slug: nil, options: nil)
303
+ new.list_idp_groups_for_a_team(org, team_slug, options)
304
+ end
305
+
306
+ def self.create_or_update_idp_group_connections(org: nil, team_slug: nil, groups: nil, options: nil)
307
+ new.create_or_update_idp_group_connections(org, team_slug, groups, options)
308
+ end
309
+
310
+ def self.list_idp_groups_for_a_team_legacy(team_id: nil, options: nil)
311
+ new.list_idp_groups_for_a_team_legacy(team_id, options)
312
+ end
313
+
314
+ def self.create_or_update_idp_group_connections_legacy(team_id: nil, groups: nil, synced_at: nil, options: nil)
315
+ new.create_or_update_idp_group_connections_legacy(team_id, groups, synced_at, options)
316
+ end
317
+
318
+ private
319
+
320
+ # list teams
321
+ #
322
+ # @param org [String]
323
+ #
324
+ # @return TeamsResult, TeamsErrorResult
325
+ def list_teams(org, options)
326
+ auth = nil
327
+ body = nil
328
+ headers = { accept: 'application/vnd.github.v3+json' }
329
+ params = { per_page: options[:per_page], page: options[:page] }
330
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams"
331
+
332
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
333
+
334
+ if http_call.successful?
335
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
336
+ else
337
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
338
+ end
339
+ end
340
+
341
+ # create a team
342
+ #
343
+ # @param org [String]
344
+ # @param name [String] Required. The name of the team.
345
+ # @param description [String] The description of the team.
346
+ # @param maintainers [Array of strings] List GitHub IDs for organization members who will become team maintainers.
347
+ # @param repo_names [Array of strings] The full name (e.g., "organization-name/repository-name") of repositories to add the team to.
348
+ # @param privacy [String] The level of privacy this team should have. The options are:
349
+ # For a non-nested team:
350
+ # * secret - only visible to organization owners and members of this team.
351
+ # * closed - visible to all members of this organization.
352
+ # Default: secret
353
+ # For a parent or child team:
354
+ # * closed - visible to all members of this organization.
355
+ # Default for child team: closed
356
+ # @param permission [String] Deprecated. The permission that new repositories will be added to the team with when none is specified. Can be one of:
357
+ # * pull - team members can pull, but not push to or administer newly-added repositories.
358
+ # * push - team members can pull and push, but not administer newly-added repositories.Default: pull
359
+ # @param parent_team_id [Integer] The ID of a team to set as the parent team.
360
+ #
361
+ # @return TeamsResult, TeamsErrorResult
362
+ def create_a_team(org, name, description, maintainers, repo_names, privacy, permission, parent_team_id, _options)
363
+ auth = nil
364
+ body = { name: name, description: description, maintainers: maintainers, repo_names: repo_names, privacy: privacy, permission: permission, parent_team_id: parent_team_id }
365
+ headers = { accept: 'application/vnd.github.v3+json' }
366
+ params = nil
367
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams"
368
+
369
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
370
+
371
+ if http_call.successful?
372
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
373
+ else
374
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
375
+ end
376
+ end
377
+
378
+ # get a team by name
379
+ #
380
+ # @param org [String]
381
+ # @param team_slug [String] team_slug parameter
382
+ #
383
+ # @return TeamsResult, TeamsErrorResult
384
+ def get_a_team_by_name(org, team_slug, _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}/teams/#{team_slug}"
390
+
391
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
392
+
393
+ if http_call.successful?
394
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
395
+ else
396
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
397
+ end
398
+ end
399
+
400
+ # update a team
401
+ #
402
+ # @param org [String]
403
+ # @param team_slug [String] team_slug parameter
404
+ # @param name [String] The name of the team.
405
+ # @param description [String] The description of the team.
406
+ # @param privacy [String] The level of privacy this team should have. Editing teams without specifying this parameter leaves privacy intact. When a team is nested, the privacy for parent teams cannot be secret. The options are:
407
+ # For a non-nested team:
408
+ # * secret - only visible to organization owners and members of this team.
409
+ # * closed - visible to all members of this organization.
410
+ # For a parent or child team:
411
+ # * closed - visible to all members of this organization.
412
+ # @param permission [String] Deprecated. The permission that new repositories will be added to the team with when none is specified. Can be one of:
413
+ # * pull - team members can pull, but not push to or administer newly-added repositories.
414
+ # * push - team members can pull and push, but not administer newly-added repositories.
415
+ # * admin - team members can pull, push and administer newly-added repositories.Default: pull
416
+ # @param parent_team_id [Integer or null] The ID of a team to set as the parent team.
417
+ #
418
+ # @return TeamsResult, TeamsErrorResult
419
+ def update_a_team(org, team_slug, name, description, privacy, permission, parent_team_id, _options)
420
+ auth = nil
421
+ body = { name: name, description: description, privacy: privacy, permission: permission, parent_team_id: parent_team_id }
422
+ headers = { accept: 'application/vnd.github.v3+json' }
423
+ params = nil
424
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}"
425
+
426
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
427
+
428
+ if http_call.successful?
429
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
430
+ else
431
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
432
+ end
433
+ end
434
+
435
+ # delete a team
436
+ #
437
+ # @param org [String]
438
+ # @param team_slug [String] team_slug parameter
439
+ #
440
+ # @return TeamsResult, TeamsErrorResult
441
+ def delete_a_team(org, team_slug, _options)
442
+ auth = nil
443
+ body = nil
444
+ headers = { accept: 'application/vnd.github.v3+json' }
445
+ params = nil
446
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}"
447
+
448
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
449
+
450
+ if http_call.successful?
451
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
452
+ else
453
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
454
+ end
455
+ end
456
+
457
+ # list team projects
458
+ #
459
+ # @param org [String]
460
+ # @param team_slug [String] team_slug parameter
461
+ #
462
+ # @return TeamsResult, TeamsErrorResult
463
+ def list_team_projects(org, team_slug, options)
464
+ auth = nil
465
+ body = nil
466
+ headers = { accept: 'application/vnd.github.v3+json' }
467
+ params = { per_page: options[:per_page], page: options[:page] }
468
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/projects"
469
+
470
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
471
+
472
+ if http_call.successful?
473
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
474
+ else
475
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
476
+ end
477
+ end
478
+
479
+ # check team permissions for a project
480
+ #
481
+ # @param org [String]
482
+ # @param team_slug [String] team_slug parameter
483
+ # @param project_id [Integer]
484
+ #
485
+ # @return TeamsResult, TeamsErrorResult
486
+ def check_team_permissions_for_a_project(org, team_slug, project_id, _options)
487
+ auth = nil
488
+ body = nil
489
+ headers = { accept: 'application/vnd.github.v3+json' }
490
+ params = nil
491
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/projects/#{project_id}"
492
+
493
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
494
+
495
+ if http_call.successful?
496
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
497
+ else
498
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
499
+ end
500
+ end
501
+
502
+ # add or update team project permissions
503
+ #
504
+ # @param org [String]
505
+ # @param team_slug [String] team_slug parameter
506
+ # @param project_id [Integer]
507
+ # @param permission [String] The permission to grant to the team for this project. Can be one of:
508
+ # * read - team members can read, but not write to or administer this project.
509
+ # * write - team members can read and write, but not administer this project.
510
+ # * admin - team members can read, write and administer this project.
511
+ # Default: the team's permission attribute will be used to determine what permission to grant the team on this project. Note that, if you choose not to pass any parameters, you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
512
+ #
513
+ # @return TeamsResult, TeamsErrorResult
514
+ def add_or_update_team_project_permissions(org, team_slug, project_id, permission, _options)
515
+ auth = nil
516
+ body = { permission: permission }
517
+ headers = { accept: 'application/vnd.github.v3+json' }
518
+ params = nil
519
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/projects/#{project_id}"
520
+
521
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
522
+
523
+ if http_call.successful?
524
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
525
+ else
526
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
527
+ end
528
+ end
529
+
530
+ # remove a project from a team
531
+ #
532
+ # @param org [String]
533
+ # @param team_slug [String] team_slug parameter
534
+ # @param project_id [Integer]
535
+ #
536
+ # @return TeamsResult, TeamsErrorResult
537
+ def remove_a_project_from_a_team(org, team_slug, project_id, _options)
538
+ auth = nil
539
+ body = nil
540
+ headers = { accept: 'application/vnd.github.v3+json' }
541
+ params = nil
542
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/projects/#{project_id}"
543
+
544
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
545
+
546
+ if http_call.successful?
547
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
548
+ else
549
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
550
+ end
551
+ end
552
+
553
+ # list team repositories
554
+ #
555
+ # @param org [String]
556
+ # @param team_slug [String] team_slug parameter
557
+ #
558
+ # @return TeamsResult, TeamsErrorResult
559
+ def list_team_repositories(org, team_slug, options)
560
+ auth = nil
561
+ body = nil
562
+ headers = { accept: 'application/vnd.github.v3+json' }
563
+ params = { per_page: options[:per_page], page: options[:page] }
564
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/repos"
565
+
566
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
567
+
568
+ if http_call.successful?
569
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
570
+ else
571
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
572
+ end
573
+ end
574
+
575
+ # check team permissions for a repository
576
+ #
577
+ # @param org [String]
578
+ # @param team_slug [String] team_slug parameter
579
+ # @param owner [String]
580
+ # @param repo [String]
581
+ #
582
+ # @return TeamsResult, TeamsErrorResult
583
+ def check_team_permissions_for_a_repository(org, team_slug, owner, repo, _options)
584
+ auth = nil
585
+ body = nil
586
+ headers = { accept: 'application/vnd.github.v3+json' }
587
+ params = nil
588
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/repos/#{owner}/#{repo}"
589
+
590
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
591
+
592
+ if http_call.successful?
593
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
594
+ else
595
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
596
+ end
597
+ end
598
+
599
+ # add or update team repository permissions
600
+ #
601
+ # @param org [String]
602
+ # @param team_slug [String] team_slug parameter
603
+ # @param owner [String]
604
+ # @param repo [String]
605
+ # @param permission [String] The permission to grant the team on this repository. Can be one of:
606
+ # * pull - team members can pull, but not push to or administer this repository.
607
+ # * push - team members can pull and push, but not administer this repository.
608
+ # * admin - team members can pull, push and administer this repository.
609
+ # * maintain - team members can manage the repository without access to sensitive or destructive actions. Recommended for project managers. Only applies to repositories owned by organizations.
610
+ # * triage - team members can proactively manage issues and pull requests without write access. Recommended for contributors who triage a repository. Only applies to repositories owned by organizations.
611
+ # * custom repository role name - A custom repository role if the owning organization has defined any.
612
+ # If no permission is specified, the team's permission attribute will be used to determine what permission to grant the team on this repository.Default: push
613
+ #
614
+ # @return TeamsResult, TeamsErrorResult
615
+ def add_or_update_team_repository_permissions(org, team_slug, owner, repo, permission, _options)
616
+ auth = nil
617
+ body = { permission: permission }
618
+ headers = { accept: 'application/vnd.github.v3+json' }
619
+ params = nil
620
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/repos/#{owner}/#{repo}"
621
+
622
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
623
+
624
+ if http_call.successful?
625
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
626
+ else
627
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
628
+ end
629
+ end
630
+
631
+ # remove a repository from a team
632
+ #
633
+ # @param org [String]
634
+ # @param team_slug [String] team_slug parameter
635
+ # @param owner [String]
636
+ # @param repo [String]
637
+ #
638
+ # @return TeamsResult, TeamsErrorResult
639
+ def remove_a_repository_from_a_team(org, team_slug, owner, repo, _options)
640
+ auth = nil
641
+ body = nil
642
+ headers = { accept: 'application/vnd.github.v3+json' }
643
+ params = nil
644
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/repos/#{owner}/#{repo}"
645
+
646
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
647
+
648
+ if http_call.successful?
649
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
650
+ else
651
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
652
+ end
653
+ end
654
+
655
+ # list child teams
656
+ #
657
+ # @param org [String]
658
+ # @param team_slug [String] team_slug parameter
659
+ #
660
+ # @return TeamsResult, TeamsErrorResult
661
+ def list_child_teams(org, team_slug, options)
662
+ auth = nil
663
+ body = nil
664
+ headers = { accept: 'application/vnd.github.v3+json' }
665
+ params = { per_page: options[:per_page], page: options[:page] }
666
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/teams"
667
+
668
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
669
+
670
+ if http_call.successful?
671
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
672
+ else
673
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
674
+ end
675
+ end
676
+
677
+ # get a team legacy
678
+ #
679
+ # @param team_id [Integer]
680
+ #
681
+ # @return TeamsResult, TeamsErrorResult
682
+ def get_a_team_legacy(team_id, _options)
683
+ auth = nil
684
+ body = nil
685
+ headers = { accept: 'application/vnd.github.v3+json' }
686
+ params = nil
687
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}"
688
+
689
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
690
+
691
+ if http_call.successful?
692
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
693
+ else
694
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
695
+ end
696
+ end
697
+
698
+ # update a team legacy
699
+ #
700
+ # @param team_id [Integer]
701
+ # @param name [String] Required. The name of the team.
702
+ # @param description [String] The description of the team.
703
+ # @param privacy [String] The level of privacy this team should have. Editing teams without specifying this parameter leaves privacy intact. The options are:
704
+ # For a non-nested team:
705
+ # * secret - only visible to organization owners and members of this team.
706
+ # * closed - visible to all members of this organization.
707
+ # For a parent or child team:
708
+ # * closed - visible to all members of this organization.
709
+ # @param permission [String] Deprecated. The permission that new repositories will be added to the team with when none is specified. Can be one of:
710
+ # * pull - team members can pull, but not push to or administer newly-added repositories.
711
+ # * push - team members can pull and push, but not administer newly-added repositories.
712
+ # * admin - team members can pull, push and administer newly-added repositories.Default: pull
713
+ # @param parent_team_id [Integer or null] The ID of a team to set as the parent team.
714
+ #
715
+ # @return TeamsResult, TeamsErrorResult
716
+ def update_a_team_legacy(team_id, name, description, privacy, permission, parent_team_id, _options)
717
+ auth = nil
718
+ body = { name: name, description: description, privacy: privacy, permission: permission, parent_team_id: parent_team_id }
719
+ headers = { accept: 'application/vnd.github.v3+json' }
720
+ params = nil
721
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}"
722
+
723
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
724
+
725
+ if http_call.successful?
726
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
727
+ else
728
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
729
+ end
730
+ end
731
+
732
+ # delete a team legacy
733
+ #
734
+ # @param team_id [Integer]
735
+ #
736
+ # @return TeamsResult, TeamsErrorResult
737
+ def delete_a_team_legacy(team_id, _options)
738
+ auth = nil
739
+ body = nil
740
+ headers = { accept: 'application/vnd.github.v3+json' }
741
+ params = nil
742
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}"
743
+
744
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
745
+
746
+ if http_call.successful?
747
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
748
+ else
749
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
750
+ end
751
+ end
752
+
753
+ # list team projects legacy
754
+ #
755
+ # @param team_id [Integer]
756
+ #
757
+ # @return TeamsResult, TeamsErrorResult
758
+ def list_team_projects_legacy(team_id, options)
759
+ auth = nil
760
+ body = nil
761
+ headers = { accept: 'application/vnd.github.v3+json' }
762
+ params = { per_page: options[:per_page], page: options[:page] }
763
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/projects"
764
+
765
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
766
+
767
+ if http_call.successful?
768
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
769
+ else
770
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
771
+ end
772
+ end
773
+
774
+ # check team permissions for a project legacy
775
+ #
776
+ # @param team_id [Integer]
777
+ # @param project_id [Integer]
778
+ #
779
+ # @return TeamsResult, TeamsErrorResult
780
+ def check_team_permissions_for_a_project_legacy(team_id, project_id, _options)
781
+ auth = nil
782
+ body = nil
783
+ headers = { accept: 'application/vnd.github.v3+json' }
784
+ params = nil
785
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/projects/#{project_id}"
786
+
787
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
788
+
789
+ if http_call.successful?
790
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
791
+ else
792
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
793
+ end
794
+ end
795
+
796
+ # add or update team project permissions legacy
797
+ #
798
+ # @param team_id [Integer]
799
+ # @param project_id [Integer]
800
+ # @param permission [String] The permission to grant to the team for this project. Can be one of:
801
+ # * read - team members can read, but not write to or administer this project.
802
+ # * write - team members can read and write, but not administer this project.
803
+ # * admin - team members can read, write and administer this project.
804
+ # Default: the team's permission attribute will be used to determine what permission to grant the team on this project. Note that, if you choose not to pass any parameters, you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
805
+ #
806
+ # @return TeamsResult, TeamsErrorResult
807
+ def add_or_update_team_project_permissions_legacy(team_id, project_id, permission, _options)
808
+ auth = nil
809
+ body = { permission: permission }
810
+ headers = { accept: 'application/vnd.github.v3+json' }
811
+ params = nil
812
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/projects/#{project_id}"
813
+
814
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
815
+
816
+ if http_call.successful?
817
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
818
+ else
819
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
820
+ end
821
+ end
822
+
823
+ # remove a project from a team legacy
824
+ #
825
+ # @param team_id [Integer]
826
+ # @param project_id [Integer]
827
+ #
828
+ # @return TeamsResult, TeamsErrorResult
829
+ def remove_a_project_from_a_team_legacy(team_id, project_id, _options)
830
+ auth = nil
831
+ body = nil
832
+ headers = { accept: 'application/vnd.github.v3+json' }
833
+ params = nil
834
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/projects/#{project_id}"
835
+
836
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
837
+
838
+ if http_call.successful?
839
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
840
+ else
841
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
842
+ end
843
+ end
844
+
845
+ # list team repositories legacy
846
+ #
847
+ # @param team_id [Integer]
848
+ #
849
+ # @return TeamsResult, TeamsErrorResult
850
+ def list_team_repositories_legacy(team_id, options)
851
+ auth = nil
852
+ body = nil
853
+ headers = { accept: 'application/vnd.github.v3+json' }
854
+ params = { per_page: options[:per_page], page: options[:page] }
855
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/repos"
856
+
857
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
858
+
859
+ if http_call.successful?
860
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
861
+ else
862
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
863
+ end
864
+ end
865
+
866
+ # check team permissions for a repository legacy
867
+ #
868
+ # @param team_id [Integer]
869
+ # @param owner [String]
870
+ # @param repo [String]
871
+ #
872
+ # @return TeamsResult, TeamsErrorResult
873
+ def check_team_permissions_for_a_repository_legacy(team_id, owner, repo, _options)
874
+ auth = nil
875
+ body = nil
876
+ headers = { accept: 'application/vnd.github.v3+json' }
877
+ params = nil
878
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/repos/#{owner}/#{repo}"
879
+
880
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
881
+
882
+ if http_call.successful?
883
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
884
+ else
885
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
886
+ end
887
+ end
888
+
889
+ # add or update team repository permissions legacy
890
+ #
891
+ # @param team_id [Integer]
892
+ # @param owner [String]
893
+ # @param repo [String]
894
+ # @param permission [String] The permission to grant the team on this repository. Can be one of:
895
+ # * pull - team members can pull, but not push to or administer this repository.
896
+ # * push - team members can pull and push, but not administer this repository.
897
+ # * admin - team members can pull, push and administer this repository.
898
+ # If no permission is specified, the team's permission attribute will be used to determine what permission to grant the team on this repository.
899
+ #
900
+ # @return TeamsResult, TeamsErrorResult
901
+ def add_or_update_team_repository_permissions_legacy(team_id, owner, repo, permission, _options)
902
+ auth = nil
903
+ body = { permission: permission }
904
+ headers = { accept: 'application/vnd.github.v3+json' }
905
+ params = nil
906
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/repos/#{owner}/#{repo}"
907
+
908
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
909
+
910
+ if http_call.successful?
911
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
912
+ else
913
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
914
+ end
915
+ end
916
+
917
+ # remove a repository from a team legacy
918
+ #
919
+ # @param team_id [Integer]
920
+ # @param owner [String]
921
+ # @param repo [String]
922
+ #
923
+ # @return TeamsResult, TeamsErrorResult
924
+ def remove_a_repository_from_a_team_legacy(team_id, owner, repo, _options)
925
+ auth = nil
926
+ body = nil
927
+ headers = { accept: 'application/vnd.github.v3+json' }
928
+ params = nil
929
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/repos/#{owner}/#{repo}"
930
+
931
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
932
+
933
+ if http_call.successful?
934
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
935
+ else
936
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
937
+ end
938
+ end
939
+
940
+ # list child teams legacy
941
+ #
942
+ # @param team_id [Integer]
943
+ #
944
+ # @return TeamsResult, TeamsErrorResult
945
+ def list_child_teams_legacy(team_id, options)
946
+ auth = nil
947
+ body = nil
948
+ headers = { accept: 'application/vnd.github.v3+json' }
949
+ params = { per_page: options[:per_page], page: options[:page] }
950
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/teams"
951
+
952
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
953
+
954
+ if http_call.successful?
955
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
956
+ else
957
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
958
+ end
959
+ end
960
+
961
+ # list teams for the authenticated user
962
+ #
963
+ # @params options [Hash]
964
+ #
965
+ # @return TeamsResult, TeamsErrorResult
966
+ def list_teams_for_the_authenticated_user(options)
967
+ auth = nil
968
+ body = nil
969
+ headers = { accept: 'application/vnd.github.v3+json' }
970
+ params = { per_page: options[:per_page], page: options[:page] }
971
+ uri = "#{Gitabu::BASE_URL}/user/teams"
972
+
973
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
974
+
975
+ if http_call.successful?
976
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
977
+ else
978
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
979
+ end
980
+ end
981
+
982
+ # list discussion comments
983
+ #
984
+ # @param org [String]
985
+ # @param team_slug [String] team_slug parameter
986
+ # @param discussion_number [Integer]
987
+ #
988
+ # @return TeamsResult, TeamsErrorResult
989
+ def list_discussion_comments(org, team_slug, discussion_number, options)
990
+ auth = nil
991
+ body = nil
992
+ headers = { accept: 'application/vnd.github.v3+json' }
993
+ params = { direction: options[:direction], per_page: options[:per_page], page: options[:page] }
994
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/discussions/#{discussion_number}/comments"
995
+
996
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
997
+
998
+ if http_call.successful?
999
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1000
+ else
1001
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1002
+ end
1003
+ end
1004
+
1005
+ # create a discussion comment
1006
+ #
1007
+ # @param org [String]
1008
+ # @param team_slug [String] team_slug parameter
1009
+ # @param discussion_number [Integer]
1010
+ # @param body [String] Required. The discussion comment's body text.
1011
+ #
1012
+ # @return TeamsResult, TeamsErrorResult
1013
+ def create_a_discussion_comment(org, team_slug, discussion_number, body, _options)
1014
+ auth = nil
1015
+ body = { body: body }
1016
+ headers = { accept: 'application/vnd.github.v3+json' }
1017
+ params = nil
1018
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/discussions/#{discussion_number}/comments"
1019
+
1020
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
1021
+
1022
+ if http_call.successful?
1023
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1024
+ else
1025
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1026
+ end
1027
+ end
1028
+
1029
+ # get a discussion comment
1030
+ #
1031
+ # @param org [String]
1032
+ # @param team_slug [String] team_slug parameter
1033
+ # @param discussion_number [Integer]
1034
+ # @param comment_number [Integer]
1035
+ #
1036
+ # @return TeamsResult, TeamsErrorResult
1037
+ def get_a_discussion_comment(org, team_slug, discussion_number, comment_number, _options)
1038
+ auth = nil
1039
+ body = nil
1040
+ headers = { accept: 'application/vnd.github.v3+json' }
1041
+ params = nil
1042
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/discussions/#{discussion_number}/comments/#{comment_number}"
1043
+
1044
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1045
+
1046
+ if http_call.successful?
1047
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1048
+ else
1049
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1050
+ end
1051
+ end
1052
+
1053
+ # update a discussion comment
1054
+ #
1055
+ # @param org [String]
1056
+ # @param team_slug [String] team_slug parameter
1057
+ # @param discussion_number [Integer]
1058
+ # @param comment_number [Integer]
1059
+ # @param body [String] Required. The discussion comment's body text.
1060
+ #
1061
+ # @return TeamsResult, TeamsErrorResult
1062
+ def update_a_discussion_comment(org, team_slug, discussion_number, comment_number, body, _options)
1063
+ auth = nil
1064
+ body = { body: body }
1065
+ headers = { accept: 'application/vnd.github.v3+json' }
1066
+ params = nil
1067
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/discussions/#{discussion_number}/comments/#{comment_number}"
1068
+
1069
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
1070
+
1071
+ if http_call.successful?
1072
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1073
+ else
1074
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1075
+ end
1076
+ end
1077
+
1078
+ # delete a discussion comment
1079
+ #
1080
+ # @param org [String]
1081
+ # @param team_slug [String] team_slug parameter
1082
+ # @param discussion_number [Integer]
1083
+ # @param comment_number [Integer]
1084
+ #
1085
+ # @return TeamsResult, TeamsErrorResult
1086
+ def delete_a_discussion_comment(org, team_slug, discussion_number, comment_number, _options)
1087
+ auth = nil
1088
+ body = nil
1089
+ headers = { accept: 'application/vnd.github.v3+json' }
1090
+ params = nil
1091
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/discussions/#{discussion_number}/comments/#{comment_number}"
1092
+
1093
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
1094
+
1095
+ if http_call.successful?
1096
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1097
+ else
1098
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1099
+ end
1100
+ end
1101
+
1102
+ # list discussion comments legacy
1103
+ #
1104
+ # @param team_id [Integer]
1105
+ # @param discussion_number [Integer]
1106
+ #
1107
+ # @return TeamsResult, TeamsErrorResult
1108
+ def list_discussion_comments_legacy(team_id, discussion_number, options)
1109
+ auth = nil
1110
+ body = nil
1111
+ headers = { accept: 'application/vnd.github.v3+json' }
1112
+ params = { direction: options[:direction], per_page: options[:per_page], page: options[:page] }
1113
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/discussions/#{discussion_number}/comments"
1114
+
1115
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1116
+
1117
+ if http_call.successful?
1118
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1119
+ else
1120
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1121
+ end
1122
+ end
1123
+
1124
+ # create a discussion comment legacy
1125
+ #
1126
+ # @param team_id [Integer]
1127
+ # @param discussion_number [Integer]
1128
+ # @param body [String] Required. The discussion comment's body text.
1129
+ #
1130
+ # @return TeamsResult, TeamsErrorResult
1131
+ def create_a_discussion_comment_legacy(team_id, discussion_number, body, _options)
1132
+ auth = nil
1133
+ body = { body: body }
1134
+ headers = { accept: 'application/vnd.github.v3+json' }
1135
+ params = nil
1136
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/discussions/#{discussion_number}/comments"
1137
+
1138
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
1139
+
1140
+ if http_call.successful?
1141
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1142
+ else
1143
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1144
+ end
1145
+ end
1146
+
1147
+ # get a discussion comment legacy
1148
+ #
1149
+ # @param team_id [Integer]
1150
+ # @param discussion_number [Integer]
1151
+ # @param comment_number [Integer]
1152
+ #
1153
+ # @return TeamsResult, TeamsErrorResult
1154
+ def get_a_discussion_comment_legacy(team_id, discussion_number, comment_number, _options)
1155
+ auth = nil
1156
+ body = nil
1157
+ headers = { accept: 'application/vnd.github.v3+json' }
1158
+ params = nil
1159
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/discussions/#{discussion_number}/comments/#{comment_number}"
1160
+
1161
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1162
+
1163
+ if http_call.successful?
1164
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1165
+ else
1166
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1167
+ end
1168
+ end
1169
+
1170
+ # update a discussion comment legacy
1171
+ #
1172
+ # @param team_id [Integer]
1173
+ # @param discussion_number [Integer]
1174
+ # @param comment_number [Integer]
1175
+ # @param body [String] Required. The discussion comment's body text.
1176
+ #
1177
+ # @return TeamsResult, TeamsErrorResult
1178
+ def update_a_discussion_comment_legacy(team_id, discussion_number, comment_number, body, _options)
1179
+ auth = nil
1180
+ body = { body: body }
1181
+ headers = { accept: 'application/vnd.github.v3+json' }
1182
+ params = nil
1183
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/discussions/#{discussion_number}/comments/#{comment_number}"
1184
+
1185
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
1186
+
1187
+ if http_call.successful?
1188
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1189
+ else
1190
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1191
+ end
1192
+ end
1193
+
1194
+ # delete a discussion comment legacy
1195
+ #
1196
+ # @param team_id [Integer]
1197
+ # @param discussion_number [Integer]
1198
+ # @param comment_number [Integer]
1199
+ #
1200
+ # @return TeamsResult, TeamsErrorResult
1201
+ def delete_a_discussion_comment_legacy(team_id, discussion_number, comment_number, _options)
1202
+ auth = nil
1203
+ body = nil
1204
+ headers = { accept: 'application/vnd.github.v3+json' }
1205
+ params = nil
1206
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/discussions/#{discussion_number}/comments/#{comment_number}"
1207
+
1208
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
1209
+
1210
+ if http_call.successful?
1211
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1212
+ else
1213
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1214
+ end
1215
+ end
1216
+
1217
+ # list discussions
1218
+ #
1219
+ # @param org [String]
1220
+ # @param team_slug [String] team_slug parameter
1221
+ #
1222
+ # @return TeamsResult, TeamsErrorResult
1223
+ def list_discussions(org, team_slug, options)
1224
+ auth = nil
1225
+ body = nil
1226
+ headers = { accept: 'application/vnd.github.v3+json' }
1227
+ params = { direction: options[:direction], per_page: options[:per_page], page: options[:page], pinned: options[:pinned] }
1228
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/discussions"
1229
+
1230
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1231
+
1232
+ if http_call.successful?
1233
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1234
+ else
1235
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1236
+ end
1237
+ end
1238
+
1239
+ # create a discussion
1240
+ #
1241
+ # @param org [String]
1242
+ # @param team_slug [String] team_slug parameter
1243
+ # @param title [String] Required. The discussion post's title.
1244
+ # @param body [String] Required. The discussion post's body text.
1245
+ # @param private [Boolean] Private posts are only visible to team members, organization owners, and team maintainers. Public posts are visible to all members of the organization. Set to true to create a private post.
1246
+ #
1247
+ # @return TeamsResult, TeamsErrorResult
1248
+ def create_a_discussion(org, team_slug, title, body, private, _options)
1249
+ auth = nil
1250
+ body = { title: title, body: body, private: private }
1251
+ headers = { accept: 'application/vnd.github.v3+json' }
1252
+ params = nil
1253
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/discussions"
1254
+
1255
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
1256
+
1257
+ if http_call.successful?
1258
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1259
+ else
1260
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1261
+ end
1262
+ end
1263
+
1264
+ # get a discussion
1265
+ #
1266
+ # @param org [String]
1267
+ # @param team_slug [String] team_slug parameter
1268
+ # @param discussion_number [Integer]
1269
+ #
1270
+ # @return TeamsResult, TeamsErrorResult
1271
+ def get_a_discussion(org, team_slug, discussion_number, _options)
1272
+ auth = nil
1273
+ body = nil
1274
+ headers = { accept: 'application/vnd.github.v3+json' }
1275
+ params = nil
1276
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/discussions/#{discussion_number}"
1277
+
1278
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1279
+
1280
+ if http_call.successful?
1281
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1282
+ else
1283
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1284
+ end
1285
+ end
1286
+
1287
+ # update a discussion
1288
+ #
1289
+ # @param org [String]
1290
+ # @param team_slug [String] team_slug parameter
1291
+ # @param discussion_number [Integer]
1292
+ # @param title [String] The discussion post's title.
1293
+ # @param body [String] The discussion post's body text.
1294
+ #
1295
+ # @return TeamsResult, TeamsErrorResult
1296
+ def update_a_discussion(org, team_slug, discussion_number, title, body, _options)
1297
+ auth = nil
1298
+ body = { title: title, body: body }
1299
+ headers = { accept: 'application/vnd.github.v3+json' }
1300
+ params = nil
1301
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/discussions/#{discussion_number}"
1302
+
1303
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
1304
+
1305
+ if http_call.successful?
1306
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1307
+ else
1308
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1309
+ end
1310
+ end
1311
+
1312
+ # delete a discussion
1313
+ #
1314
+ # @param org [String]
1315
+ # @param team_slug [String] team_slug parameter
1316
+ # @param discussion_number [Integer]
1317
+ #
1318
+ # @return TeamsResult, TeamsErrorResult
1319
+ def delete_a_discussion(org, team_slug, discussion_number, _options)
1320
+ auth = nil
1321
+ body = nil
1322
+ headers = { accept: 'application/vnd.github.v3+json' }
1323
+ params = nil
1324
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/discussions/#{discussion_number}"
1325
+
1326
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
1327
+
1328
+ if http_call.successful?
1329
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1330
+ else
1331
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1332
+ end
1333
+ end
1334
+
1335
+ # list discussions legacy
1336
+ #
1337
+ # @param team_id [Integer]
1338
+ #
1339
+ # @return TeamsResult, TeamsErrorResult
1340
+ def list_discussions_legacy(team_id, options)
1341
+ auth = nil
1342
+ body = nil
1343
+ headers = { accept: 'application/vnd.github.v3+json' }
1344
+ params = { direction: options[:direction], per_page: options[:per_page], page: options[:page] }
1345
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/discussions"
1346
+
1347
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1348
+
1349
+ if http_call.successful?
1350
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1351
+ else
1352
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1353
+ end
1354
+ end
1355
+
1356
+ # create a discussion legacy
1357
+ #
1358
+ # @param team_id [Integer]
1359
+ # @param title [String] Required. The discussion post's title.
1360
+ # @param body [String] Required. The discussion post's body text.
1361
+ # @param private [Boolean] Private posts are only visible to team members, organization owners, and team maintainers. Public posts are visible to all members of the organization. Set to true to create a private post.
1362
+ #
1363
+ # @return TeamsResult, TeamsErrorResult
1364
+ def create_a_discussion_legacy(team_id, title, body, private, _options)
1365
+ auth = nil
1366
+ body = { title: title, body: body, private: private }
1367
+ headers = { accept: 'application/vnd.github.v3+json' }
1368
+ params = nil
1369
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/discussions"
1370
+
1371
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
1372
+
1373
+ if http_call.successful?
1374
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1375
+ else
1376
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1377
+ end
1378
+ end
1379
+
1380
+ # get a discussion legacy
1381
+ #
1382
+ # @param team_id [Integer]
1383
+ # @param discussion_number [Integer]
1384
+ #
1385
+ # @return TeamsResult, TeamsErrorResult
1386
+ def get_a_discussion_legacy(team_id, discussion_number, _options)
1387
+ auth = nil
1388
+ body = nil
1389
+ headers = { accept: 'application/vnd.github.v3+json' }
1390
+ params = nil
1391
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/discussions/#{discussion_number}"
1392
+
1393
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1394
+
1395
+ if http_call.successful?
1396
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1397
+ else
1398
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1399
+ end
1400
+ end
1401
+
1402
+ # update a discussion legacy
1403
+ #
1404
+ # @param team_id [Integer]
1405
+ # @param discussion_number [Integer]
1406
+ # @param title [String] The discussion post's title.
1407
+ # @param body [String] The discussion post's body text.
1408
+ #
1409
+ # @return TeamsResult, TeamsErrorResult
1410
+ def update_a_discussion_legacy(team_id, discussion_number, title, body, _options)
1411
+ auth = nil
1412
+ body = { title: title, body: body }
1413
+ headers = { accept: 'application/vnd.github.v3+json' }
1414
+ params = nil
1415
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/discussions/#{discussion_number}"
1416
+
1417
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
1418
+
1419
+ if http_call.successful?
1420
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1421
+ else
1422
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1423
+ end
1424
+ end
1425
+
1426
+ # delete a discussion legacy
1427
+ #
1428
+ # @param team_id [Integer]
1429
+ # @param discussion_number [Integer]
1430
+ #
1431
+ # @return TeamsResult, TeamsErrorResult
1432
+ def delete_a_discussion_legacy(team_id, discussion_number, _options)
1433
+ auth = nil
1434
+ body = nil
1435
+ headers = { accept: 'application/vnd.github.v3+json' }
1436
+ params = nil
1437
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/discussions/#{discussion_number}"
1438
+
1439
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
1440
+
1441
+ if http_call.successful?
1442
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1443
+ else
1444
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1445
+ end
1446
+ end
1447
+
1448
+ # get an external group
1449
+ #
1450
+ # @param org [String]
1451
+ # @param group_id [Integer] group_id parameter
1452
+ #
1453
+ # @return TeamsResult, TeamsErrorResult
1454
+ def get_an_external_group(org, group_id, _options)
1455
+ auth = nil
1456
+ body = nil
1457
+ headers = { accept: 'application/vnd.github.v3+json' }
1458
+ params = nil
1459
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/external-group/#{group_id}"
1460
+
1461
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1462
+
1463
+ if http_call.successful?
1464
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1465
+ else
1466
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1467
+ end
1468
+ end
1469
+
1470
+ # list external groups in an organization
1471
+ #
1472
+ # @param org [String]
1473
+ #
1474
+ # @return TeamsResult, TeamsErrorResult
1475
+ def list_external_groups_in_an_organization(org, options)
1476
+ auth = nil
1477
+ body = nil
1478
+ headers = { accept: 'application/vnd.github.v3+json' }
1479
+ params = { per_page: options[:per_page], page: options[:page], display_name: options[:display_name] }
1480
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/external-groups"
1481
+
1482
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1483
+
1484
+ if http_call.successful?
1485
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1486
+ else
1487
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1488
+ end
1489
+ end
1490
+
1491
+ # list a connection between an external group and a team
1492
+ #
1493
+ # @param org [String]
1494
+ # @param team_slug [String] team_slug parameter
1495
+ #
1496
+ # @return TeamsResult, TeamsErrorResult
1497
+ def list_a_connection_between_an_external_group_and_a_team(org, team_slug, _options)
1498
+ auth = nil
1499
+ body = nil
1500
+ headers = { accept: 'application/vnd.github.v3+json' }
1501
+ params = nil
1502
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/external-groups"
1503
+
1504
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1505
+
1506
+ if http_call.successful?
1507
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1508
+ else
1509
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1510
+ end
1511
+ end
1512
+
1513
+ # update the connection between an external group and a team
1514
+ #
1515
+ # @param org [String]
1516
+ # @param team_slug [String] team_slug parameter
1517
+ # @param group_id [Integer] Required. External Group Id
1518
+ #
1519
+ # @return TeamsResult, TeamsErrorResult
1520
+ def update_the_connection_between_an_external_group_and_a_team(org, team_slug, group_id, _options)
1521
+ auth = nil
1522
+ body = { group_id: group_id }
1523
+ headers = { accept: 'application/vnd.github.v3+json' }
1524
+ params = nil
1525
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/external-groups"
1526
+
1527
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
1528
+
1529
+ if http_call.successful?
1530
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1531
+ else
1532
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1533
+ end
1534
+ end
1535
+
1536
+ # remove the connection between an external group and a team
1537
+ #
1538
+ # @param org [String]
1539
+ # @param team_slug [String] team_slug parameter
1540
+ #
1541
+ # @return TeamsResult, TeamsErrorResult
1542
+ def remove_the_connection_between_an_external_group_and_a_team(org, team_slug, _options)
1543
+ auth = nil
1544
+ body = nil
1545
+ headers = { accept: 'application/vnd.github.v3+json' }
1546
+ params = nil
1547
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/external-groups"
1548
+
1549
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
1550
+
1551
+ if http_call.successful?
1552
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1553
+ else
1554
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1555
+ end
1556
+ end
1557
+
1558
+ # list pending team invitations
1559
+ #
1560
+ # @param org [String]
1561
+ # @param team_slug [String] team_slug parameter
1562
+ #
1563
+ # @return TeamsResult, TeamsErrorResult
1564
+ def list_pending_team_invitations(org, team_slug, options)
1565
+ auth = nil
1566
+ body = nil
1567
+ headers = { accept: 'application/vnd.github.v3+json' }
1568
+ params = { per_page: options[:per_page], page: options[:page] }
1569
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/invitations"
1570
+
1571
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1572
+
1573
+ if http_call.successful?
1574
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1575
+ else
1576
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1577
+ end
1578
+ end
1579
+
1580
+ # list team members
1581
+ #
1582
+ # @param org [String]
1583
+ # @param team_slug [String] team_slug parameter
1584
+ #
1585
+ # @return TeamsResult, TeamsErrorResult
1586
+ def list_team_members(org, team_slug, options)
1587
+ auth = nil
1588
+ body = nil
1589
+ headers = { accept: 'application/vnd.github.v3+json' }
1590
+ params = { role: options[:role], per_page: options[:per_page], page: options[:page] }
1591
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/members"
1592
+
1593
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1594
+
1595
+ if http_call.successful?
1596
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1597
+ else
1598
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1599
+ end
1600
+ end
1601
+
1602
+ # get team membership for a user
1603
+ #
1604
+ # @param org [String]
1605
+ # @param team_slug [String] team_slug parameter
1606
+ # @param username [String]
1607
+ #
1608
+ # @return TeamsResult, TeamsErrorResult
1609
+ def get_team_membership_for_a_user(org, team_slug, username, _options)
1610
+ auth = nil
1611
+ body = nil
1612
+ headers = { accept: 'application/vnd.github.v3+json' }
1613
+ params = nil
1614
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/memberships/#{username}"
1615
+
1616
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1617
+
1618
+ if http_call.successful?
1619
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1620
+ else
1621
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1622
+ end
1623
+ end
1624
+
1625
+ # add or update team membership for a user
1626
+ #
1627
+ # @param org [String]
1628
+ # @param team_slug [String] team_slug parameter
1629
+ # @param username [String]
1630
+ # @param role [String] The role that this user should have in the team. Can be one of:
1631
+ # * member - a normal member of the team.
1632
+ # * maintainer - a team maintainer. Able to add/remove other team members, promote other team members to team maintainer, and edit the team's name and description.Default: member
1633
+ #
1634
+ # @return TeamsResult, TeamsErrorResult
1635
+ def add_or_update_team_membership_for_a_user(org, team_slug, username, role, _options)
1636
+ auth = nil
1637
+ body = { role: role }
1638
+ headers = { accept: 'application/vnd.github.v3+json' }
1639
+ params = nil
1640
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/memberships/#{username}"
1641
+
1642
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
1643
+
1644
+ if http_call.successful?
1645
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1646
+ else
1647
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1648
+ end
1649
+ end
1650
+
1651
+ # remove team membership for a user
1652
+ #
1653
+ # @param org [String]
1654
+ # @param team_slug [String] team_slug parameter
1655
+ # @param username [String]
1656
+ #
1657
+ # @return TeamsResult, TeamsErrorResult
1658
+ def remove_team_membership_for_a_user(org, team_slug, username, _options)
1659
+ auth = nil
1660
+ body = nil
1661
+ headers = { accept: 'application/vnd.github.v3+json' }
1662
+ params = nil
1663
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/memberships/#{username}"
1664
+
1665
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
1666
+
1667
+ if http_call.successful?
1668
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1669
+ else
1670
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1671
+ end
1672
+ end
1673
+
1674
+ # list pending team invitations legacy
1675
+ #
1676
+ # @param team_id [Integer]
1677
+ #
1678
+ # @return TeamsResult, TeamsErrorResult
1679
+ def list_pending_team_invitations_legacy(team_id, options)
1680
+ auth = nil
1681
+ body = nil
1682
+ headers = { accept: 'application/vnd.github.v3+json' }
1683
+ params = { per_page: options[:per_page], page: options[:page] }
1684
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/invitations"
1685
+
1686
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1687
+
1688
+ if http_call.successful?
1689
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1690
+ else
1691
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1692
+ end
1693
+ end
1694
+
1695
+ # list team members legacy
1696
+ #
1697
+ # @param team_id [Integer]
1698
+ #
1699
+ # @return TeamsResult, TeamsErrorResult
1700
+ def list_team_members_legacy(team_id, options)
1701
+ auth = nil
1702
+ body = nil
1703
+ headers = { accept: 'application/vnd.github.v3+json' }
1704
+ params = { role: options[:role], per_page: options[:per_page], page: options[:page] }
1705
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/members"
1706
+
1707
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1708
+
1709
+ if http_call.successful?
1710
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1711
+ else
1712
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1713
+ end
1714
+ end
1715
+
1716
+ # get team member legacy
1717
+ #
1718
+ # @param team_id [Integer]
1719
+ # @param username [String]
1720
+ #
1721
+ # @return TeamsResult, TeamsErrorResult
1722
+ def get_team_member_legacy(team_id, username, _options)
1723
+ auth = nil
1724
+ body = nil
1725
+ headers = { accept: 'application/vnd.github.v3+json' }
1726
+ params = nil
1727
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/members/#{username}"
1728
+
1729
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1730
+
1731
+ if http_call.successful?
1732
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1733
+ else
1734
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1735
+ end
1736
+ end
1737
+
1738
+ # add team member legacy
1739
+ #
1740
+ # @param team_id [Integer]
1741
+ # @param username [String]
1742
+ #
1743
+ # @return TeamsResult, TeamsErrorResult
1744
+ def add_team_member_legacy(team_id, username, _options)
1745
+ auth = nil
1746
+ body = nil
1747
+ headers = { accept: 'application/vnd.github.v3+json' }
1748
+ params = nil
1749
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/members/#{username}"
1750
+
1751
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
1752
+
1753
+ if http_call.successful?
1754
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1755
+ else
1756
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1757
+ end
1758
+ end
1759
+
1760
+ # remove team member legacy
1761
+ #
1762
+ # @param team_id [Integer]
1763
+ # @param username [String]
1764
+ #
1765
+ # @return TeamsResult, TeamsErrorResult
1766
+ def remove_team_member_legacy(team_id, username, _options)
1767
+ auth = nil
1768
+ body = nil
1769
+ headers = { accept: 'application/vnd.github.v3+json' }
1770
+ params = nil
1771
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/members/#{username}"
1772
+
1773
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
1774
+
1775
+ if http_call.successful?
1776
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1777
+ else
1778
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1779
+ end
1780
+ end
1781
+
1782
+ # get team membership for a user legacy
1783
+ #
1784
+ # @param team_id [Integer]
1785
+ # @param username [String]
1786
+ #
1787
+ # @return TeamsResult, TeamsErrorResult
1788
+ def get_team_membership_for_a_user_legacy(team_id, username, _options)
1789
+ auth = nil
1790
+ body = nil
1791
+ headers = { accept: 'application/vnd.github.v3+json' }
1792
+ params = nil
1793
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/memberships/#{username}"
1794
+
1795
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1796
+
1797
+ if http_call.successful?
1798
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1799
+ else
1800
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1801
+ end
1802
+ end
1803
+
1804
+ # add or update team membership for a user legacy
1805
+ #
1806
+ # @param team_id [Integer]
1807
+ # @param username [String]
1808
+ # @param role [String] The role that this user should have in the team. Can be one of:
1809
+ # * member - a normal member of the team.
1810
+ # * maintainer - a team maintainer. Able to add/remove other team members, promote other team members to team maintainer, and edit the team's name and description.Default: member
1811
+ #
1812
+ # @return TeamsResult, TeamsErrorResult
1813
+ def add_or_update_team_membership_for_a_user_legacy(team_id, username, role, _options)
1814
+ auth = nil
1815
+ body = { role: role }
1816
+ headers = { accept: 'application/vnd.github.v3+json' }
1817
+ params = nil
1818
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/memberships/#{username}"
1819
+
1820
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
1821
+
1822
+ if http_call.successful?
1823
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1824
+ else
1825
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1826
+ end
1827
+ end
1828
+
1829
+ # remove team membership for a user legacy
1830
+ #
1831
+ # @param team_id [Integer]
1832
+ # @param username [String]
1833
+ #
1834
+ # @return TeamsResult, TeamsErrorResult
1835
+ def remove_team_membership_for_a_user_legacy(team_id, username, _options)
1836
+ auth = nil
1837
+ body = nil
1838
+ headers = { accept: 'application/vnd.github.v3+json' }
1839
+ params = nil
1840
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/memberships/#{username}"
1841
+
1842
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
1843
+
1844
+ if http_call.successful?
1845
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1846
+ else
1847
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1848
+ end
1849
+ end
1850
+
1851
+ # list idp groups for an organization
1852
+ #
1853
+ # @param org [String]
1854
+ #
1855
+ # @return TeamsResult, TeamsErrorResult
1856
+ def list_idp_groups_for_an_organization(org, options)
1857
+ auth = nil
1858
+ body = nil
1859
+ headers = { accept: 'application/vnd.github.v3+json' }
1860
+ params = { per_page: options[:per_page], page: options[:page] }
1861
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/team-sync/groups"
1862
+
1863
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1864
+
1865
+ if http_call.successful?
1866
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1867
+ else
1868
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1869
+ end
1870
+ end
1871
+
1872
+ # list idp groups for a team
1873
+ #
1874
+ # @param org [String]
1875
+ # @param team_slug [String] team_slug parameter
1876
+ #
1877
+ # @return TeamsResult, TeamsErrorResult
1878
+ def list_idp_groups_for_a_team(org, team_slug, _options)
1879
+ auth = nil
1880
+ body = nil
1881
+ headers = { accept: 'application/vnd.github.v3+json' }
1882
+ params = nil
1883
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/team-sync/group-mappings"
1884
+
1885
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1886
+
1887
+ if http_call.successful?
1888
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1889
+ else
1890
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1891
+ end
1892
+ end
1893
+
1894
+ # create or update idp group connections
1895
+ #
1896
+ # @param org [String]
1897
+ # @param team_slug [String] team_slug parameter
1898
+ # @param groups [Array of objects] The IdP groups you want to connect to a GitHub team. When updating, the new groups object will replace the original one. You must include any existing groups that you don't want to remove.
1899
+ #
1900
+ # @return TeamsResult, TeamsErrorResult
1901
+ def create_or_update_idp_group_connections(org, team_slug, groups, _options)
1902
+ auth = nil
1903
+ body = { groups: groups }
1904
+ headers = { accept: 'application/vnd.github.v3+json' }
1905
+ params = nil
1906
+ uri = "#{Gitabu::BASE_URL}/orgs/#{org}/teams/#{team_slug}/team-sync/group-mappings"
1907
+
1908
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
1909
+
1910
+ if http_call.successful?
1911
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1912
+ else
1913
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1914
+ end
1915
+ end
1916
+
1917
+ # list idp groups for a team legacy
1918
+ #
1919
+ # @param team_id [Integer]
1920
+ #
1921
+ # @return TeamsResult, TeamsErrorResult
1922
+ def list_idp_groups_for_a_team_legacy(team_id, _options)
1923
+ auth = nil
1924
+ body = nil
1925
+ headers = { accept: 'application/vnd.github.v3+json' }
1926
+ params = nil
1927
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/team-sync/group-mappings"
1928
+
1929
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
1930
+
1931
+ if http_call.successful?
1932
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1933
+ else
1934
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1935
+ end
1936
+ end
1937
+
1938
+ # create or update idp group connections legacy
1939
+ #
1940
+ # @param team_id [Integer]
1941
+ # @param groups [Array of objects] Required. The IdP groups you want to connect to a GitHub team. When updating, the new groups object will replace the original one. You must include any existing groups that you don't want to remove.
1942
+ # @param synced_at [String]
1943
+ #
1944
+ # @return TeamsResult, TeamsErrorResult
1945
+ def create_or_update_idp_group_connections_legacy(team_id, groups, synced_at, _options)
1946
+ auth = nil
1947
+ body = { groups: groups, synced_at: synced_at }
1948
+ headers = { accept: 'application/vnd.github.v3+json' }
1949
+ params = nil
1950
+ uri = "#{Gitabu::BASE_URL}/teams/#{team_id}/team-sync/group-mappings"
1951
+
1952
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :patch, params: params, uri: uri)
1953
+
1954
+ if http_call.successful?
1955
+ TeamsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
1956
+ else
1957
+ TeamsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
1958
+ end
1959
+ end
1960
+ end
1961
+ end
1962
+ end
1963
+ end