labclient 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (615) hide show
  1. checksums.yaml +7 -0
  2. data/lib/labclient/access_levels.rb +47 -0
  3. data/lib/labclient/appearance/appearance.rb +7 -0
  4. data/lib/labclient/appearance/show.rb +19 -0
  5. data/lib/labclient/appearance/update.rb +37 -0
  6. data/lib/labclient/application_settings/application_setting.rb +10 -0
  7. data/lib/labclient/application_settings/show.rb +52 -0
  8. data/lib/labclient/application_settings/update.rb +53 -0
  9. data/lib/labclient/application_statistics/application_statistics.rb +17 -0
  10. data/lib/labclient/applications/application.rb +19 -0
  11. data/lib/labclient/applications/create.rb +36 -0
  12. data/lib/labclient/applications/delete.rb +35 -0
  13. data/lib/labclient/applications/list.rb +18 -0
  14. data/lib/labclient/approvals/client.rb +16 -0
  15. data/lib/labclient/approvals/merge_approval.rb +20 -0
  16. data/lib/labclient/approvals/merge_request/approve.rb +35 -0
  17. data/lib/labclient/approvals/merge_request/create_rule.rb +38 -0
  18. data/lib/labclient/approvals/merge_request/delete_rule.rb +27 -0
  19. data/lib/labclient/approvals/merge_request/rules.rb +27 -0
  20. data/lib/labclient/approvals/merge_request/show.rb +27 -0
  21. data/lib/labclient/approvals/merge_request/unapprove.rb +35 -0
  22. data/lib/labclient/approvals/merge_request/update.rb +28 -0
  23. data/lib/labclient/approvals/merge_request/update_rule.rb +40 -0
  24. data/lib/labclient/approvals/project/create_rule.rb +38 -0
  25. data/lib/labclient/approvals/project/delete_rule.rb +26 -0
  26. data/lib/labclient/approvals/project/rules.rb +26 -0
  27. data/lib/labclient/approvals/project/show.rb +38 -0
  28. data/lib/labclient/approvals/project/update.rb +53 -0
  29. data/lib/labclient/approvals/project/update_rule.rb +39 -0
  30. data/lib/labclient/approvals/rule.rb +36 -0
  31. data/lib/labclient/audit_events/audit_event.rb +12 -0
  32. data/lib/labclient/audit_events/group_list.rb +63 -0
  33. data/lib/labclient/audit_events/group_show.rb +27 -0
  34. data/lib/labclient/audit_events/instance_list.rb +73 -0
  35. data/lib/labclient/audit_events/instance_show.rb +19 -0
  36. data/lib/labclient/avatar/avatar.rb +14 -0
  37. data/lib/labclient/avatar/show.rb +27 -0
  38. data/lib/labclient/awards/award.rb +17 -0
  39. data/lib/labclient/awards/issues/client.rb +17 -0
  40. data/lib/labclient/awards/issues/create.rb +23 -0
  41. data/lib/labclient/awards/issues/delete.rb +20 -0
  42. data/lib/labclient/awards/issues/list.rb +22 -0
  43. data/lib/labclient/awards/issues/show.rb +22 -0
  44. data/lib/labclient/awards/merge_requests/client.rb +17 -0
  45. data/lib/labclient/awards/merge_requests/create.rb +23 -0
  46. data/lib/labclient/awards/merge_requests/delete.rb +20 -0
  47. data/lib/labclient/awards/merge_requests/list.rb +22 -0
  48. data/lib/labclient/awards/merge_requests/show.rb +22 -0
  49. data/lib/labclient/awards/snippets/client.rb +17 -0
  50. data/lib/labclient/awards/snippets/create.rb +23 -0
  51. data/lib/labclient/awards/snippets/delete.rb +20 -0
  52. data/lib/labclient/awards/snippets/list.rb +22 -0
  53. data/lib/labclient/awards/snippets/show.rb +22 -0
  54. data/lib/labclient/branches/branch.rb +15 -0
  55. data/lib/labclient/branches/delete.rb +24 -0
  56. data/lib/labclient/branches/delete_merged.rb +25 -0
  57. data/lib/labclient/branches/list.rb +35 -0
  58. data/lib/labclient/branches/show.rb +24 -0
  59. data/lib/labclient/broadcast_messages/broadcast_message.rb +31 -0
  60. data/lib/labclient/broadcast_messages/create.rb +66 -0
  61. data/lib/labclient/broadcast_messages/delete.rb +36 -0
  62. data/lib/labclient/broadcast_messages/list.rb +18 -0
  63. data/lib/labclient/broadcast_messages/show.rb +18 -0
  64. data/lib/labclient/broadcast_messages/update.rb +75 -0
  65. data/lib/labclient/ci_lint/ci_lint.rb +43 -0
  66. data/lib/labclient/class_helpers.rb +17 -0
  67. data/lib/labclient/client.rb +157 -0
  68. data/lib/labclient/commits/cherry_pick.rb +40 -0
  69. data/lib/labclient/commits/comment_create.rb +67 -0
  70. data/lib/labclient/commits/comments.rb +39 -0
  71. data/lib/labclient/commits/commit.rb +101 -0
  72. data/lib/labclient/commits/commit_comment.rb +14 -0
  73. data/lib/labclient/commits/commit_diff.rb +7 -0
  74. data/lib/labclient/commits/create.rb +83 -0
  75. data/lib/labclient/commits/diff.rb +39 -0
  76. data/lib/labclient/commits/list.rb +54 -0
  77. data/lib/labclient/commits/merge_requests.rb +40 -0
  78. data/lib/labclient/commits/project_helpers.rb +49 -0
  79. data/lib/labclient/commits/refs.rb +44 -0
  80. data/lib/labclient/commits/revert.rb +40 -0
  81. data/lib/labclient/commits/show.rb +25 -0
  82. data/lib/labclient/commits/status/list.rb +57 -0
  83. data/lib/labclient/commits/status/status.rb +14 -0
  84. data/lib/labclient/commits/status/update.rb +53 -0
  85. data/lib/labclient/common.rb +110 -0
  86. data/lib/labclient/curl.rb +27 -0
  87. data/lib/labclient/deploy_keys/add.rb +46 -0
  88. data/lib/labclient/deploy_keys/delete.rb +46 -0
  89. data/lib/labclient/deploy_keys/deploy_key.rb +30 -0
  90. data/lib/labclient/deploy_keys/enable.rb +38 -0
  91. data/lib/labclient/deploy_keys/list.rb +38 -0
  92. data/lib/labclient/deploy_keys/project_helpers.rb +29 -0
  93. data/lib/labclient/deploy_keys/show.rb +30 -0
  94. data/lib/labclient/deploy_keys/update.rb +53 -0
  95. data/lib/labclient/discussions/commits/client.rb +17 -0
  96. data/lib/labclient/discussions/commits/create.rb +32 -0
  97. data/lib/labclient/discussions/commits/delete.rb +20 -0
  98. data/lib/labclient/discussions/commits/list.rb +22 -0
  99. data/lib/labclient/discussions/commits/show.rb +22 -0
  100. data/lib/labclient/discussions/commits/update.rb +32 -0
  101. data/lib/labclient/discussions/discussion.rb +17 -0
  102. data/lib/labclient/discussions/epics/client.rb +17 -0
  103. data/lib/labclient/discussions/epics/create.rb +32 -0
  104. data/lib/labclient/discussions/epics/delete.rb +20 -0
  105. data/lib/labclient/discussions/epics/list.rb +22 -0
  106. data/lib/labclient/discussions/epics/show.rb +22 -0
  107. data/lib/labclient/discussions/epics/update.rb +32 -0
  108. data/lib/labclient/discussions/issues/client.rb +17 -0
  109. data/lib/labclient/discussions/issues/create.rb +32 -0
  110. data/lib/labclient/discussions/issues/delete.rb +20 -0
  111. data/lib/labclient/discussions/issues/list.rb +22 -0
  112. data/lib/labclient/discussions/issues/show.rb +22 -0
  113. data/lib/labclient/discussions/issues/update.rb +32 -0
  114. data/lib/labclient/discussions/merge_requests/client.rb +17 -0
  115. data/lib/labclient/discussions/merge_requests/create.rb +32 -0
  116. data/lib/labclient/discussions/merge_requests/delete.rb +20 -0
  117. data/lib/labclient/discussions/merge_requests/list.rb +22 -0
  118. data/lib/labclient/discussions/merge_requests/show.rb +22 -0
  119. data/lib/labclient/discussions/merge_requests/update.rb +32 -0
  120. data/lib/labclient/discussions/snippets/client.rb +17 -0
  121. data/lib/labclient/discussions/snippets/create.rb +32 -0
  122. data/lib/labclient/discussions/snippets/delete.rb +20 -0
  123. data/lib/labclient/discussions/snippets/list.rb +22 -0
  124. data/lib/labclient/discussions/snippets/show.rb +22 -0
  125. data/lib/labclient/discussions/snippets/update.rb +32 -0
  126. data/lib/labclient/docs.rb +107 -0
  127. data/lib/labclient/epics/create.rb +42 -0
  128. data/lib/labclient/epics/delete.rb +35 -0
  129. data/lib/labclient/epics/epic.rb +72 -0
  130. data/lib/labclient/epics/issues/add.rb +35 -0
  131. data/lib/labclient/epics/issues/list.rb +38 -0
  132. data/lib/labclient/epics/issues/remove.rb +37 -0
  133. data/lib/labclient/epics/issues/update.rb +44 -0
  134. data/lib/labclient/epics/list.rb +54 -0
  135. data/lib/labclient/epics/show.rb +29 -0
  136. data/lib/labclient/epics/todo.rb +27 -0
  137. data/lib/labclient/epics/update.rb +52 -0
  138. data/lib/labclient/error.rb +11 -0
  139. data/lib/labclient/events/event.rb +13 -0
  140. data/lib/labclient/events/list.rb +67 -0
  141. data/lib/labclient/events/project.rb +67 -0
  142. data/lib/labclient/events/user.rb +66 -0
  143. data/lib/labclient/files/create.rb +49 -0
  144. data/lib/labclient/files/delete.rb +43 -0
  145. data/lib/labclient/files/show.rb +48 -0
  146. data/lib/labclient/files/update.rb +49 -0
  147. data/lib/labclient/groups/access_requests/access_request.rb +34 -0
  148. data/lib/labclient/groups/access_requests/approve.rb +38 -0
  149. data/lib/labclient/groups/access_requests/client.rb +17 -0
  150. data/lib/labclient/groups/access_requests/create.rb +25 -0
  151. data/lib/labclient/groups/access_requests/deny.rb +25 -0
  152. data/lib/labclient/groups/access_requests/list.rb +24 -0
  153. data/lib/labclient/groups/badges/client.rb +17 -0
  154. data/lib/labclient/groups/badges/create.rb +49 -0
  155. data/lib/labclient/groups/badges/delete.rb +33 -0
  156. data/lib/labclient/groups/badges/group_badge.rb +47 -0
  157. data/lib/labclient/groups/badges/list.rb +28 -0
  158. data/lib/labclient/groups/badges/preview.rb +42 -0
  159. data/lib/labclient/groups/badges/show.rb +27 -0
  160. data/lib/labclient/groups/badges/update.rb +45 -0
  161. data/lib/labclient/groups/create.rb +31 -0
  162. data/lib/labclient/groups/delete.rb +25 -0
  163. data/lib/labclient/groups/group.rb +317 -0
  164. data/lib/labclient/groups/hooks/client.rb +17 -0
  165. data/lib/labclient/groups/hooks/create.rb +46 -0
  166. data/lib/labclient/groups/hooks/delete.rb +33 -0
  167. data/lib/labclient/groups/hooks/group_hook.rb +37 -0
  168. data/lib/labclient/groups/hooks/list.rb +31 -0
  169. data/lib/labclient/groups/hooks/show.rb +27 -0
  170. data/lib/labclient/groups/hooks/update.rb +55 -0
  171. data/lib/labclient/groups/labels/client.rb +17 -0
  172. data/lib/labclient/groups/labels/create.rb +39 -0
  173. data/lib/labclient/groups/labels/delete.rb +33 -0
  174. data/lib/labclient/groups/labels/group_label.rb +49 -0
  175. data/lib/labclient/groups/labels/list.rb +35 -0
  176. data/lib/labclient/groups/labels/show.rb +34 -0
  177. data/lib/labclient/groups/labels/subscribe.rb +35 -0
  178. data/lib/labclient/groups/labels/unsubscribe.rb +35 -0
  179. data/lib/labclient/groups/labels/update.rb +46 -0
  180. data/lib/labclient/groups/ldap/client.rb +18 -0
  181. data/lib/labclient/groups/ldap/create.rb +35 -0
  182. data/lib/labclient/groups/ldap/delete.rb +37 -0
  183. data/lib/labclient/groups/ldap/link.rb +17 -0
  184. data/lib/labclient/groups/ldap/list.rb +27 -0
  185. data/lib/labclient/groups/ldap/sync.rb +27 -0
  186. data/lib/labclient/groups/list.rb +76 -0
  187. data/lib/labclient/groups/milestones/burndown.rb +36 -0
  188. data/lib/labclient/groups/milestones/client.rb +17 -0
  189. data/lib/labclient/groups/milestones/create.rb +37 -0
  190. data/lib/labclient/groups/milestones/delete.rb +26 -0
  191. data/lib/labclient/groups/milestones/group_milestone.rb +52 -0
  192. data/lib/labclient/groups/milestones/issues.rb +29 -0
  193. data/lib/labclient/groups/milestones/list.rb +41 -0
  194. data/lib/labclient/groups/milestones/merge_requests.rb +29 -0
  195. data/lib/labclient/groups/milestones/show.rb +20 -0
  196. data/lib/labclient/groups/milestones/update.rb +45 -0
  197. data/lib/labclient/groups/projects.rb +54 -0
  198. data/lib/labclient/groups/restore.rb +26 -0
  199. data/lib/labclient/groups/runners.rb +33 -0
  200. data/lib/labclient/groups/search.rb +89 -0
  201. data/lib/labclient/groups/show.rb +37 -0
  202. data/lib/labclient/groups/subgroups.rb +47 -0
  203. data/lib/labclient/groups/transfer.rb +27 -0
  204. data/lib/labclient/groups/update.rb +34 -0
  205. data/lib/labclient/http.rb +87 -0
  206. data/lib/labclient/impersonation_tokens/create.rb +37 -0
  207. data/lib/labclient/impersonation_tokens/impersonation_token.rb +18 -0
  208. data/lib/labclient/impersonation_tokens/list.rb +29 -0
  209. data/lib/labclient/impersonation_tokens/revoke.rb +32 -0
  210. data/lib/labclient/impersonation_tokens/show.rb +18 -0
  211. data/lib/labclient/issues/agent_detail.rb +31 -0
  212. data/lib/labclient/issues/closed_by.rb +27 -0
  213. data/lib/labclient/issues/create.rb +29 -0
  214. data/lib/labclient/issues/delete.rb +26 -0
  215. data/lib/labclient/issues/group_issues.rb +29 -0
  216. data/lib/labclient/issues/issue.rb +114 -0
  217. data/lib/labclient/issues/list.rb +58 -0
  218. data/lib/labclient/issues/move.rb +28 -0
  219. data/lib/labclient/issues/notes.rb +18 -0
  220. data/lib/labclient/issues/participants.rb +35 -0
  221. data/lib/labclient/issues/project_issues.rb +31 -0
  222. data/lib/labclient/issues/related_merge_requests.rb +30 -0
  223. data/lib/labclient/issues/show.rb +21 -0
  224. data/lib/labclient/issues/subscribe.rb +31 -0
  225. data/lib/labclient/issues/time_stats.rb +157 -0
  226. data/lib/labclient/issues/todo.rb +31 -0
  227. data/lib/labclient/issues/unsubscribe.rb +31 -0
  228. data/lib/labclient/issues/update.rb +44 -0
  229. data/lib/labclient/jobs/artifacts.rb +49 -0
  230. data/lib/labclient/jobs/artifacts_latest.rb +39 -0
  231. data/lib/labclient/jobs/artifacts_path.rb +50 -0
  232. data/lib/labclient/jobs/cancel.rb +33 -0
  233. data/lib/labclient/jobs/delete.rb +33 -0
  234. data/lib/labclient/jobs/erase.rb +33 -0
  235. data/lib/labclient/jobs/job.rb +79 -0
  236. data/lib/labclient/jobs/keep.rb +33 -0
  237. data/lib/labclient/jobs/pipeline_list.rb +33 -0
  238. data/lib/labclient/jobs/play.rb +33 -0
  239. data/lib/labclient/jobs/project_list.rb +30 -0
  240. data/lib/labclient/jobs/retry.rb +33 -0
  241. data/lib/labclient/jobs/show.rb +25 -0
  242. data/lib/labclient/jobs/trace.rb +33 -0
  243. data/lib/labclient/keys/fingerprint.rb +27 -0
  244. data/lib/labclient/keys/key.rb +26 -0
  245. data/lib/labclient/keys/project.rb +68 -0
  246. data/lib/labclient/keys/show.rb +15 -0
  247. data/lib/labclient/keys/user.rb +66 -0
  248. data/lib/labclient/klass.rb +107 -0
  249. data/lib/labclient/license/add.rb +21 -0
  250. data/lib/labclient/license/delete.rb +17 -0
  251. data/lib/labclient/license/license.rb +12 -0
  252. data/lib/labclient/license/list.rb +71 -0
  253. data/lib/labclient/markdown/markdown.rb +28 -0
  254. data/lib/labclient/members/groups/add.rb +37 -0
  255. data/lib/labclient/members/groups/delete.rb +23 -0
  256. data/lib/labclient/members/groups/list.rb +67 -0
  257. data/lib/labclient/members/groups/show.rb +49 -0
  258. data/lib/labclient/members/groups/update.rb +36 -0
  259. data/lib/labclient/members/member.rb +56 -0
  260. data/lib/labclient/members/members.rb +15 -0
  261. data/lib/labclient/members/projects/add.rb +37 -0
  262. data/lib/labclient/members/projects/delete.rb +23 -0
  263. data/lib/labclient/members/projects/list.rb +66 -0
  264. data/lib/labclient/members/projects/show.rb +49 -0
  265. data/lib/labclient/members/projects/update.rb +36 -0
  266. data/lib/labclient/merge_requests/accept.rb +39 -0
  267. data/lib/labclient/merge_requests/cancel_auto_merge.rb +38 -0
  268. data/lib/labclient/merge_requests/change.rb +25 -0
  269. data/lib/labclient/merge_requests/changes.rb +34 -0
  270. data/lib/labclient/merge_requests/closes_issues.rb +35 -0
  271. data/lib/labclient/merge_requests/commits.rb +22 -0
  272. data/lib/labclient/merge_requests/create.rb +51 -0
  273. data/lib/labclient/merge_requests/delete.rb +31 -0
  274. data/lib/labclient/merge_requests/diff.rb +28 -0
  275. data/lib/labclient/merge_requests/diff_versions.rb +70 -0
  276. data/lib/labclient/merge_requests/list.rb +105 -0
  277. data/lib/labclient/merge_requests/merge_ref.rb +48 -0
  278. data/lib/labclient/merge_requests/merge_request.rb +211 -0
  279. data/lib/labclient/merge_requests/notes.rb +18 -0
  280. data/lib/labclient/merge_requests/participants.rb +36 -0
  281. data/lib/labclient/merge_requests/pipelines.rb +63 -0
  282. data/lib/labclient/merge_requests/rebase.rb +45 -0
  283. data/lib/labclient/merge_requests/show.rb +32 -0
  284. data/lib/labclient/merge_requests/subscribe.rb +31 -0
  285. data/lib/labclient/merge_requests/time_stats.rb +157 -0
  286. data/lib/labclient/merge_requests/todo.rb +31 -0
  287. data/lib/labclient/merge_requests/unsubscribe.rb +31 -0
  288. data/lib/labclient/merge_requests/update.rb +35 -0
  289. data/lib/labclient/namespaces/list.rb +30 -0
  290. data/lib/labclient/namespaces/namespace.rb +10 -0
  291. data/lib/labclient/namespaces/show.rb +18 -0
  292. data/lib/labclient/notes/epics/client.rb +17 -0
  293. data/lib/labclient/notes/epics/create.rb +32 -0
  294. data/lib/labclient/notes/epics/delete.rb +20 -0
  295. data/lib/labclient/notes/epics/list.rb +22 -0
  296. data/lib/labclient/notes/epics/show.rb +22 -0
  297. data/lib/labclient/notes/epics/update.rb +32 -0
  298. data/lib/labclient/notes/issues/client.rb +17 -0
  299. data/lib/labclient/notes/issues/create.rb +32 -0
  300. data/lib/labclient/notes/issues/delete.rb +20 -0
  301. data/lib/labclient/notes/issues/list.rb +22 -0
  302. data/lib/labclient/notes/issues/show.rb +22 -0
  303. data/lib/labclient/notes/issues/update.rb +32 -0
  304. data/lib/labclient/notes/merge_requests/client.rb +17 -0
  305. data/lib/labclient/notes/merge_requests/create.rb +32 -0
  306. data/lib/labclient/notes/merge_requests/delete.rb +20 -0
  307. data/lib/labclient/notes/merge_requests/list.rb +22 -0
  308. data/lib/labclient/notes/merge_requests/show.rb +22 -0
  309. data/lib/labclient/notes/merge_requests/update.rb +32 -0
  310. data/lib/labclient/notes/note.rb +17 -0
  311. data/lib/labclient/notes/snippets/client.rb +17 -0
  312. data/lib/labclient/notes/snippets/create.rb +32 -0
  313. data/lib/labclient/notes/snippets/delete.rb +20 -0
  314. data/lib/labclient/notes/snippets/list.rb +22 -0
  315. data/lib/labclient/notes/snippets/show.rb +22 -0
  316. data/lib/labclient/notes/snippets/update.rb +32 -0
  317. data/lib/labclient/notifications/list.rb +54 -0
  318. data/lib/labclient/notifications/update.rb +64 -0
  319. data/lib/labclient/open_struct.rb +14 -0
  320. data/lib/labclient/overview.rb +243 -0
  321. data/lib/labclient/paginated_response.rb +115 -0
  322. data/lib/labclient/pipelines/cancel.rb +34 -0
  323. data/lib/labclient/pipelines/create.rb +29 -0
  324. data/lib/labclient/pipelines/delete.rb +33 -0
  325. data/lib/labclient/pipelines/list.rb +50 -0
  326. data/lib/labclient/pipelines/pipeline.rb +48 -0
  327. data/lib/labclient/pipelines/retry.rb +34 -0
  328. data/lib/labclient/pipelines/show.rb +26 -0
  329. data/lib/labclient/pipelines/variables.rb +47 -0
  330. data/lib/labclient/projects/access_requests/access_request.rb +34 -0
  331. data/lib/labclient/projects/access_requests/approve.rb +38 -0
  332. data/lib/labclient/projects/access_requests/client.rb +17 -0
  333. data/lib/labclient/projects/access_requests/create.rb +25 -0
  334. data/lib/labclient/projects/access_requests/deny.rb +25 -0
  335. data/lib/labclient/projects/access_requests/list.rb +24 -0
  336. data/lib/labclient/projects/archive.rb +25 -0
  337. data/lib/labclient/projects/badges/client.rb +17 -0
  338. data/lib/labclient/projects/badges/create.rb +49 -0
  339. data/lib/labclient/projects/badges/delete.rb +33 -0
  340. data/lib/labclient/projects/badges/list.rb +28 -0
  341. data/lib/labclient/projects/badges/preview.rb +42 -0
  342. data/lib/labclient/projects/badges/project_badge.rb +47 -0
  343. data/lib/labclient/projects/badges/show.rb +27 -0
  344. data/lib/labclient/projects/badges/update.rb +45 -0
  345. data/lib/labclient/projects/clusters/add.rb +48 -0
  346. data/lib/labclient/projects/clusters/client.rb +17 -0
  347. data/lib/labclient/projects/clusters/delete.rb +37 -0
  348. data/lib/labclient/projects/clusters/list.rb +28 -0
  349. data/lib/labclient/projects/clusters/project_cluster.rb +38 -0
  350. data/lib/labclient/projects/clusters/show.rb +29 -0
  351. data/lib/labclient/projects/clusters/update.rb +37 -0
  352. data/lib/labclient/projects/create.rb +49 -0
  353. data/lib/labclient/projects/delete.rb +25 -0
  354. data/lib/labclient/projects/deployments/client.rb +17 -0
  355. data/lib/labclient/projects/deployments/create.rb +56 -0
  356. data/lib/labclient/projects/deployments/list.rb +67 -0
  357. data/lib/labclient/projects/deployments/merge_requests.rb +33 -0
  358. data/lib/labclient/projects/deployments/project_deployment.rb +39 -0
  359. data/lib/labclient/projects/deployments/show.rb +27 -0
  360. data/lib/labclient/projects/deployments/update.rb +52 -0
  361. data/lib/labclient/projects/environments/client.rb +17 -0
  362. data/lib/labclient/projects/environments/create.rb +37 -0
  363. data/lib/labclient/projects/environments/delete.rb +33 -0
  364. data/lib/labclient/projects/environments/list.rb +34 -0
  365. data/lib/labclient/projects/environments/project_environment.rb +44 -0
  366. data/lib/labclient/projects/environments/show.rb +27 -0
  367. data/lib/labclient/projects/environments/stop.rb +27 -0
  368. data/lib/labclient/projects/environments/update.rb +44 -0
  369. data/lib/labclient/projects/events.rb +19 -0
  370. data/lib/labclient/projects/forks/existing.rb +28 -0
  371. data/lib/labclient/projects/forks/fork.rb +44 -0
  372. data/lib/labclient/projects/forks/list.rb +39 -0
  373. data/lib/labclient/projects/forks/remove.rb +26 -0
  374. data/lib/labclient/projects/github_import.rb +23 -0
  375. data/lib/labclient/projects/hooks/client.rb +17 -0
  376. data/lib/labclient/projects/hooks/create.rb +46 -0
  377. data/lib/labclient/projects/hooks/delete.rb +33 -0
  378. data/lib/labclient/projects/hooks/list.rb +31 -0
  379. data/lib/labclient/projects/hooks/project_hook.rb +32 -0
  380. data/lib/labclient/projects/hooks/show.rb +27 -0
  381. data/lib/labclient/projects/hooks/update.rb +55 -0
  382. data/lib/labclient/projects/housekeeping.rb +29 -0
  383. data/lib/labclient/projects/labels/client.rb +17 -0
  384. data/lib/labclient/projects/labels/create.rb +39 -0
  385. data/lib/labclient/projects/labels/delete.rb +33 -0
  386. data/lib/labclient/projects/labels/list.rb +35 -0
  387. data/lib/labclient/projects/labels/project_label.rb +56 -0
  388. data/lib/labclient/projects/labels/promote.rb +35 -0
  389. data/lib/labclient/projects/labels/show.rb +34 -0
  390. data/lib/labclient/projects/labels/subscribe.rb +35 -0
  391. data/lib/labclient/projects/labels/unsubscribe.rb +35 -0
  392. data/lib/labclient/projects/labels/update.rb +46 -0
  393. data/lib/labclient/projects/languages.rb +28 -0
  394. data/lib/labclient/projects/list.rb +90 -0
  395. data/lib/labclient/projects/methods.rb +681 -0
  396. data/lib/labclient/projects/milestones/burndown.rb +36 -0
  397. data/lib/labclient/projects/milestones/client.rb +17 -0
  398. data/lib/labclient/projects/milestones/create.rb +37 -0
  399. data/lib/labclient/projects/milestones/delete.rb +26 -0
  400. data/lib/labclient/projects/milestones/issues.rb +29 -0
  401. data/lib/labclient/projects/milestones/list.rb +41 -0
  402. data/lib/labclient/projects/milestones/merge_requests.rb +29 -0
  403. data/lib/labclient/projects/milestones/project_milestone.rb +58 -0
  404. data/lib/labclient/projects/milestones/promote.rb +27 -0
  405. data/lib/labclient/projects/milestones/show.rb +20 -0
  406. data/lib/labclient/projects/milestones/update.rb +45 -0
  407. data/lib/labclient/projects/mirror_start.rb +26 -0
  408. data/lib/labclient/projects/mirrors/client.rb +17 -0
  409. data/lib/labclient/projects/mirrors/create.rb +41 -0
  410. data/lib/labclient/projects/mirrors/list.rb +32 -0
  411. data/lib/labclient/projects/mirrors/project_mirror.rb +30 -0
  412. data/lib/labclient/projects/mirrors/update.rb +45 -0
  413. data/lib/labclient/projects/pipeline_schedules/client.rb +17 -0
  414. data/lib/labclient/projects/pipeline_schedules/create.rb +35 -0
  415. data/lib/labclient/projects/pipeline_schedules/delete.rb +26 -0
  416. data/lib/labclient/projects/pipeline_schedules/list.rb +28 -0
  417. data/lib/labclient/projects/pipeline_schedules/pipeline_schedule.rb +69 -0
  418. data/lib/labclient/projects/pipeline_schedules/play.rb +29 -0
  419. data/lib/labclient/projects/pipeline_schedules/show.rb +20 -0
  420. data/lib/labclient/projects/pipeline_schedules/take_ownership.rb +29 -0
  421. data/lib/labclient/projects/pipeline_schedules/update.rb +43 -0
  422. data/lib/labclient/projects/pipeline_schedules/variables/client.rb +17 -0
  423. data/lib/labclient/projects/pipeline_schedules/variables/create.rb +41 -0
  424. data/lib/labclient/projects/pipeline_schedules/variables/delete.rb +38 -0
  425. data/lib/labclient/projects/pipeline_schedules/variables/update.rb +41 -0
  426. data/lib/labclient/projects/project.rb +17 -0
  427. data/lib/labclient/projects/push_rules/client.rb +17 -0
  428. data/lib/labclient/projects/push_rules/create.rb +44 -0
  429. data/lib/labclient/projects/push_rules/delete.rb +32 -0
  430. data/lib/labclient/projects/push_rules/push_rule.rb +31 -0
  431. data/lib/labclient/projects/push_rules/show.rb +31 -0
  432. data/lib/labclient/projects/push_rules/update.rb +51 -0
  433. data/lib/labclient/projects/reference.rb +254 -0
  434. data/lib/labclient/projects/release_links/client.rb +17 -0
  435. data/lib/labclient/projects/release_links/create.rb +40 -0
  436. data/lib/labclient/projects/release_links/delete.rb +34 -0
  437. data/lib/labclient/projects/release_links/list.rb +37 -0
  438. data/lib/labclient/projects/release_links/project_release_link.rb +42 -0
  439. data/lib/labclient/projects/release_links/show.rb +28 -0
  440. data/lib/labclient/projects/release_links/update.rb +45 -0
  441. data/lib/labclient/projects/releases/client.rb +17 -0
  442. data/lib/labclient/projects/releases/create.rb +47 -0
  443. data/lib/labclient/projects/releases/delete.rb +33 -0
  444. data/lib/labclient/projects/releases/evidence.rb +34 -0
  445. data/lib/labclient/projects/releases/list.rb +28 -0
  446. data/lib/labclient/projects/releases/project_release.rb +58 -0
  447. data/lib/labclient/projects/releases/show.rb +27 -0
  448. data/lib/labclient/projects/releases/update.rb +47 -0
  449. data/lib/labclient/projects/resources.rb +24 -0
  450. data/lib/labclient/projects/restore.rb +26 -0
  451. data/lib/labclient/projects/runners/client.rb +17 -0
  452. data/lib/labclient/projects/runners/disable.rb +25 -0
  453. data/lib/labclient/projects/runners/enable.rb +27 -0
  454. data/lib/labclient/projects/runners/list.rb +34 -0
  455. data/lib/labclient/projects/search.rb +91 -0
  456. data/lib/labclient/projects/services/client.rb +29 -0
  457. data/lib/labclient/projects/services/delete.rb +33 -0
  458. data/lib/labclient/projects/services/list.rb +27 -0
  459. data/lib/labclient/projects/services/project_service.rb +37 -0
  460. data/lib/labclient/projects/services/show.rb +27 -0
  461. data/lib/labclient/projects/services/update.rb +41 -0
  462. data/lib/labclient/projects/share.rb +56 -0
  463. data/lib/labclient/projects/show.rb +47 -0
  464. data/lib/labclient/projects/snapshot.rb +25 -0
  465. data/lib/labclient/projects/snippets/agent_detail.rb +30 -0
  466. data/lib/labclient/projects/snippets/client.rb +17 -0
  467. data/lib/labclient/projects/snippets/content.rb +32 -0
  468. data/lib/labclient/projects/snippets/create.rb +40 -0
  469. data/lib/labclient/projects/snippets/delete.rb +26 -0
  470. data/lib/labclient/projects/snippets/list.rb +20 -0
  471. data/lib/labclient/projects/snippets/project_snippet.rb +50 -0
  472. data/lib/labclient/projects/snippets/show.rb +20 -0
  473. data/lib/labclient/projects/snippets/update.rb +42 -0
  474. data/lib/labclient/projects/stars/star.rb +49 -0
  475. data/lib/labclient/projects/stars/starred_projects.rb +51 -0
  476. data/lib/labclient/projects/stars/starrers.rb +46 -0
  477. data/lib/labclient/projects/submodule.rb +34 -0
  478. data/lib/labclient/projects/transfer.rb +27 -0
  479. data/lib/labclient/projects/triggers/client.rb +17 -0
  480. data/lib/labclient/projects/triggers/create.rb +37 -0
  481. data/lib/labclient/projects/triggers/delete.rb +33 -0
  482. data/lib/labclient/projects/triggers/list.rb +28 -0
  483. data/lib/labclient/projects/triggers/project_trigger.rb +33 -0
  484. data/lib/labclient/projects/triggers/show.rb +27 -0
  485. data/lib/labclient/projects/unarchive.rb +25 -0
  486. data/lib/labclient/projects/unshare.rb +27 -0
  487. data/lib/labclient/projects/update.rb +37 -0
  488. data/lib/labclient/projects/upload.rb +28 -0
  489. data/lib/labclient/projects/user.rb +52 -0
  490. data/lib/labclient/projects/users.rb +39 -0
  491. data/lib/labclient/projects/variables/client.rb +17 -0
  492. data/lib/labclient/projects/variables/create.rb +49 -0
  493. data/lib/labclient/projects/variables/delete.rb +33 -0
  494. data/lib/labclient/projects/variables/list.rb +28 -0
  495. data/lib/labclient/projects/variables/project_variable.rb +42 -0
  496. data/lib/labclient/projects/variables/show.rb +27 -0
  497. data/lib/labclient/projects/variables/update.rb +47 -0
  498. data/lib/labclient/protected_branches/code_owner_approval.rb +26 -0
  499. data/lib/labclient/protected_branches/list.rb +35 -0
  500. data/lib/labclient/protected_branches/protect.rb +49 -0
  501. data/lib/labclient/protected_branches/show.rb +24 -0
  502. data/lib/labclient/protected_branches/unprotect.rb +24 -0
  503. data/lib/labclient/protected_tags/list.rb +29 -0
  504. data/lib/labclient/protected_tags/protect.rb +44 -0
  505. data/lib/labclient/protected_tags/show.rb +24 -0
  506. data/lib/labclient/protected_tags/unprotect.rb +24 -0
  507. data/lib/labclient/registry/delete.rb +25 -0
  508. data/lib/labclient/registry/group.rb +33 -0
  509. data/lib/labclient/registry/list.rb +31 -0
  510. data/lib/labclient/registry/repository.rb +26 -0
  511. data/lib/labclient/registry/tags/bulk.rb +30 -0
  512. data/lib/labclient/registry/tags/delete.rb +27 -0
  513. data/lib/labclient/registry/tags/details.rb +20 -0
  514. data/lib/labclient/registry/tags/list.rb +27 -0
  515. data/lib/labclient/registry/tags/tag.rb +23 -0
  516. data/lib/labclient/repository/alias.rb +14 -0
  517. data/lib/labclient/repository/archive.rb +34 -0
  518. data/lib/labclient/repository/blob.rb +32 -0
  519. data/lib/labclient/repository/compare.rb +31 -0
  520. data/lib/labclient/repository/contributors.rb +45 -0
  521. data/lib/labclient/repository/merge_base.rb +38 -0
  522. data/lib/labclient/repository/raw_blob.rb +27 -0
  523. data/lib/labclient/repository/tree.rb +35 -0
  524. data/lib/labclient/resource_labels/epics/client.rb +9 -0
  525. data/lib/labclient/resource_labels/epics/list.rb +30 -0
  526. data/lib/labclient/resource_labels/epics/show.rb +31 -0
  527. data/lib/labclient/resource_labels/issues/client.rb +9 -0
  528. data/lib/labclient/resource_labels/issues/list.rb +30 -0
  529. data/lib/labclient/resource_labels/issues/show.rb +31 -0
  530. data/lib/labclient/resource_labels/merge_requests/client.rb +9 -0
  531. data/lib/labclient/resource_labels/merge_requests/list.rb +30 -0
  532. data/lib/labclient/resource_labels/merge_requests/show.rb +31 -0
  533. data/lib/labclient/resource_labels/resource_label.rb +22 -0
  534. data/lib/labclient/runners/all.rb +24 -0
  535. data/lib/labclient/runners/delete.rb +14 -0
  536. data/lib/labclient/runners/jobs.rb +25 -0
  537. data/lib/labclient/runners/list.rb +24 -0
  538. data/lib/labclient/runners/register.rb +30 -0
  539. data/lib/labclient/runners/remove.rb +24 -0
  540. data/lib/labclient/runners/runner.rb +41 -0
  541. data/lib/labclient/runners/show.rb +16 -0
  542. data/lib/labclient/runners/update.rb +45 -0
  543. data/lib/labclient/runners/verify.rb +22 -0
  544. data/lib/labclient/search/search.rb +18 -0
  545. data/lib/labclient/snippets/agent_detail.rb +31 -0
  546. data/lib/labclient/snippets/content.rb +33 -0
  547. data/lib/labclient/snippets/create.rb +38 -0
  548. data/lib/labclient/snippets/delete.rb +35 -0
  549. data/lib/labclient/snippets/list.rb +18 -0
  550. data/lib/labclient/snippets/public.rb +26 -0
  551. data/lib/labclient/snippets/show.rb +18 -0
  552. data/lib/labclient/snippets/snippet.rb +39 -0
  553. data/lib/labclient/snippets/update.rb +46 -0
  554. data/lib/labclient/system_hooks/add.rb +33 -0
  555. data/lib/labclient/system_hooks/delete.rb +23 -0
  556. data/lib/labclient/system_hooks/list.rb +17 -0
  557. data/lib/labclient/system_hooks/system_hook.rb +19 -0
  558. data/lib/labclient/system_hooks/test.rb +25 -0
  559. data/lib/labclient/tags/create.rb +34 -0
  560. data/lib/labclient/tags/delete.rb +25 -0
  561. data/lib/labclient/tags/list.rb +34 -0
  562. data/lib/labclient/tags/release.rb +27 -0
  563. data/lib/labclient/tags/show.rb +26 -0
  564. data/lib/labclient/tags/tag.rb +16 -0
  565. data/lib/labclient/tags/update.rb +27 -0
  566. data/lib/labclient/todos/list.rb +36 -0
  567. data/lib/labclient/todos/mark_all_done.rb +18 -0
  568. data/lib/labclient/todos/mark_done.rb +29 -0
  569. data/lib/labclient/todos/todo.rb +22 -0
  570. data/lib/labclient/users/activate.rb +25 -0
  571. data/lib/labclient/users/activity.rb +23 -0
  572. data/lib/labclient/users/block.rb +25 -0
  573. data/lib/labclient/users/counts.rb +16 -0
  574. data/lib/labclient/users/create.rb +25 -0
  575. data/lib/labclient/users/current.rb +28 -0
  576. data/lib/labclient/users/deactivate.rb +25 -0
  577. data/lib/labclient/users/delete.rb +28 -0
  578. data/lib/labclient/users/delete_identity.rb +25 -0
  579. data/lib/labclient/users/email/client.rb +18 -0
  580. data/lib/labclient/users/email/create.rb +37 -0
  581. data/lib/labclient/users/email/delete.rb +33 -0
  582. data/lib/labclient/users/email/email.rb +11 -0
  583. data/lib/labclient/users/email/list.rb +33 -0
  584. data/lib/labclient/users/email/show.rb +17 -0
  585. data/lib/labclient/users/gpg/client.rb +18 -0
  586. data/lib/labclient/users/gpg/create.rb +37 -0
  587. data/lib/labclient/users/gpg/delete.rb +33 -0
  588. data/lib/labclient/users/gpg/gpg_key.rb +13 -0
  589. data/lib/labclient/users/gpg/list.rb +33 -0
  590. data/lib/labclient/users/gpg/show.rb +17 -0
  591. data/lib/labclient/users/keys/client.rb +18 -0
  592. data/lib/labclient/users/keys/create.rb +42 -0
  593. data/lib/labclient/users/keys/delete.rb +33 -0
  594. data/lib/labclient/users/keys/list.rb +33 -0
  595. data/lib/labclient/users/keys/show.rb +17 -0
  596. data/lib/labclient/users/list.rb +64 -0
  597. data/lib/labclient/users/memberships.rb +34 -0
  598. data/lib/labclient/users/search.rb +22 -0
  599. data/lib/labclient/users/show.rb +22 -0
  600. data/lib/labclient/users/status.rb +26 -0
  601. data/lib/labclient/users/status_set.rb +23 -0
  602. data/lib/labclient/users/unblock.rb +25 -0
  603. data/lib/labclient/users/update.rb +28 -0
  604. data/lib/labclient/users/user.rb +138 -0
  605. data/lib/labclient/version/show.rb +18 -0
  606. data/lib/labclient/version.rb +3 -0
  607. data/lib/labclient/wikis/create.rb +33 -0
  608. data/lib/labclient/wikis/delete.rb +32 -0
  609. data/lib/labclient/wikis/list.rb +26 -0
  610. data/lib/labclient/wikis/show.rb +25 -0
  611. data/lib/labclient/wikis/update.rb +42 -0
  612. data/lib/labclient/wikis/upload.rb +27 -0
  613. data/lib/labclient/wikis/wiki.rb +40 -0
  614. data/lib/labclient.rb +843 -0
  615. metadata +880 -0
@@ -0,0 +1,32 @@
1
+ # Top namespace
2
+ module LabClient
3
+ # Specifics
4
+ class SnippetNotes < Common
5
+ doc 'Snippets' do
6
+ title 'Update'
7
+ desc 'Get a single project snippet. [Project ID, Snippet ID, Note ID]'
8
+ example 'client.notes.snippets.update(16, 1, 43, "Updaaate")'
9
+ result <<~DOC
10
+ => #<Note id: 43, type: Snippet>
11
+ DOC
12
+ end
13
+
14
+ doc 'Snippets' do
15
+ markdown <<~DOC
16
+ | Attribute | Type | Required | Description |
17
+ | --------- | ---- | -------- | ----------- |
18
+ | body | string | yes | Name for Badge |
19
+ DOC
20
+ end
21
+
22
+ # Show
23
+ def update(project_id, snippet_id, note_id, body)
24
+ project_id = format_id(project_id)
25
+ snippet_id = format_id(snippet_id)
26
+ note_id = format_id(note_id)
27
+ query = { body: body }
28
+
29
+ client.request(:put, "projects/#{project_id}/snippets/#{snippet_id}/notes/#{note_id}", Note, query)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,54 @@
1
+ # Top namespace
2
+ module LabClient
3
+ # Specifics
4
+ class Notifications < Common
5
+ doc '' do
6
+ subtitle 'Levels & Custom'
7
+
8
+ markdown <<~DOC
9
+ For each global/group/project a specific level, or custom settings can be specified.
10
+
11
+ See [docs](https://docs.gitlab.com/ee/api/notification_settings.html#valid-notification-levels) on valid levels and custom settings.
12
+ DOC
13
+ end
14
+
15
+ doc 'List' do
16
+ desc 'Get current notification settings and email address.'
17
+ example 'client.notifications.list_global'
18
+ result <<~DOC
19
+ => {:level=>"watch", :notification_email=>"admin@labclient.com"}
20
+ DOC
21
+ end
22
+
23
+ doc 'List' do
24
+ desc 'List Alias'
25
+ example 'client.notifications.list'
26
+ end
27
+
28
+ def list_global
29
+ client.request(:get, 'notification_settings')
30
+ end
31
+
32
+ alias list list_global
33
+
34
+ doc 'List' do
35
+ desc 'Get group notification settings. [Group ID]'
36
+ example 'client.notifications.list_group(5)'
37
+ end
38
+
39
+ def list_group(group_id)
40
+ group_id = format_id(group_id)
41
+ client.request(:get, "groups/#{group_id}/notification_settings")
42
+ end
43
+
44
+ doc 'List' do
45
+ desc 'Get project notification settings. [Project ID]'
46
+ example 'client.notifications.list_project(16)'
47
+ end
48
+
49
+ def list_project(project_id)
50
+ project_id = format_id(project_id)
51
+ client.request(:get, "projects/#{project_id}/notification_settings")
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,64 @@
1
+ # Top namespace
2
+ module LabClient
3
+ # Specifics
4
+ class Notifications < Common
5
+ doc 'Update' do
6
+ desc 'Get a namespace by ID. [Hash]'
7
+ example 'client.notifications.update_global(level: :watch)'
8
+ result <<~DOC
9
+ => {:level=>"watch", :notification_email=>"admin@labclient.com"}
10
+ DOC
11
+ end
12
+
13
+ def update_global(query)
14
+ client.request(:put, 'notification_settings', nil, query)
15
+ end
16
+
17
+ alias update update_global
18
+
19
+ doc 'Update' do
20
+ desc 'Update Group [Group ID, Hash]'
21
+ example 'client.notifications.update_group(5, level: :mention)'
22
+ end
23
+
24
+ def update_group(group_id, query)
25
+ group_id = format_id(group_id)
26
+ client.request(:put, "groups/#{group_id}/notification_settings", nil, query)
27
+ end
28
+
29
+ doc 'Update' do
30
+ desc 'Update Project [Project ID, Hash'
31
+ example 'client.notifications.update_project(16, level: :custom)'
32
+
33
+ result <<~DOC
34
+ OpenStruct {
35
+ :level => "custom",
36
+ :events => OpenStruct {
37
+ :new_release => nil,
38
+ :new_note => nil,
39
+ :new_issue => nil,
40
+ :reopen_issue => nil,
41
+ :close_issue => nil,
42
+ :reassign_issue => nil,
43
+ :issue_due => nil,
44
+ :new_merge_request => nil,
45
+ :push_to_merge_request => nil,
46
+ :reopen_merge_request => nil,
47
+ :close_merge_request => nil,
48
+ :reassign_merge_request => nil,
49
+ :merge_merge_request => nil,
50
+ :failed_pipeline => true,
51
+ :fixed_pipeline => true,
52
+ :success_pipeline => nil,
53
+ :new_epic => nil
54
+ }
55
+ }
56
+ DOC
57
+ end
58
+
59
+ def update_project(project_id, query)
60
+ project_id = format_id(project_id)
61
+ client.request(:put, "projects/#{project_id}/notification_settings", nil, query)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,14 @@
1
+ # Extend OpenStruct
2
+ class OpenStruct
3
+ def keys
4
+ to_h.keys.sort
5
+ end
6
+
7
+ def inspect
8
+ to_h.inspect
9
+ end
10
+
11
+ def as_json(*args)
12
+ super.as_json['table']
13
+ end
14
+ end
@@ -0,0 +1,243 @@
1
+ # The glorious gitlab labclient of labs
2
+ # rubocop:disable Metrics/ClassLength
3
+ module LabClient
4
+ # Helper for Docs
5
+ class Overview
6
+ extend Docs
7
+
8
+ doc 'Overview' do
9
+ title 'About'
10
+ desc <<~DOC
11
+ Labclient is another Gitlab API Gem. A focus on ease of use and helpers and snippets.
12
+
13
+ <a href="https://github.com/NARKOZ/gitlab">Gitlab</a> is an excellent gem, and is nearly complete in its implementation. While this is still a work in progress and you are looking for general use you should use it.
14
+ DOC
15
+ end
16
+
17
+ doc 'Overview' do
18
+ title 'Setup'
19
+ desc 'Install from RubyGems'
20
+ example 'gem install labclient'
21
+ end
22
+
23
+ doc 'Overview' do
24
+ title 'Initialize Client'
25
+ example <<~DOC
26
+ client = LabClient::Client.new(
27
+ url: 'https://gitlab.labclient',
28
+ token: 'gitlab api token',
29
+ ssl_verify: false
30
+ )
31
+ DOC
32
+ end
33
+
34
+ doc 'Authentication' do
35
+ title 'Credentials File'
36
+ desc 'The client will use ~/.gitlab-labclient for credentials. Configuring this will automatically setup client'
37
+ example <<~DOC
38
+ {
39
+ "url": "https://labclient",
40
+ "token": "super_secure",
41
+ "ssl_verify": false,
42
+ "paginate": false
43
+ }
44
+ DOC
45
+ end
46
+
47
+ doc 'Authentication' do
48
+ title 'Environment Variables'
49
+ desc 'If not provided, and credentials file does not exist will attempt to use ENV variables'
50
+ example <<~DOC
51
+ LABCLIENT_URL='http://gitlab.com'
52
+ LABCLIENT_TOKEN='superAwesomeToken'
53
+ client = LabClient::Client.new
54
+ DOC
55
+ end
56
+
57
+ doc 'Pagination' do
58
+ desc 'Pagination is enabled by default if not specified. Can be explicitly enabled or disabled'
59
+ example <<~DOC
60
+ client = LabClient::Client.new(
61
+ url: 'https://gitlab.labclient',
62
+ token: 'gitlab api token',
63
+ paginate: false
64
+ )
65
+ DOC
66
+ end
67
+
68
+ doc 'Pagination' do
69
+ title 'auto_paginate'
70
+ desc 'Automatically collect and return all results for a query. Accepts block'
71
+ example 'client.users.list.auto_paginate'
72
+ result <<~DOC
73
+ [
74
+ #<User id: 56, username: leonardmccoy>,
75
+ #<User id: 55, username: harrykim>,
76
+ #<User id: 54, username: princehumperdinck>,
77
+ #<User id: 53, username: yorick>,
78
+ #<User id: 52, username: anivia>,
79
+ ...
80
+ ]
81
+ DOC
82
+ end
83
+
84
+ doc 'Pagination' do
85
+ markdown '`auto_paginate` with a block'
86
+ example <<~DOC
87
+ client.users.list.auto_paginate do |page|
88
+ puts page.length
89
+ end
90
+ DOC
91
+
92
+ result <<~DOC
93
+ 20
94
+ 20
95
+ 16
96
+ DOC
97
+ end
98
+
99
+ doc 'Pagination' do
100
+ title 'each_page'
101
+ markdown 'Similar with `auto_paginate`, you can call `each_page` directly'
102
+ example <<~DOC
103
+ client.users.list.each_page do |page|
104
+ puts page.length
105
+ end
106
+ DOC
107
+
108
+ result <<~DOC
109
+ 20
110
+ 20
111
+ 16
112
+ DOC
113
+ end
114
+
115
+ doc 'Pagination' do
116
+ title 'paginate_with_limit'
117
+ desc 'Iterate through pages, but end when a certain limit is reached'
118
+ example <<~DOC
119
+ client.users.list.paginate_with_limit(25)
120
+ DOC
121
+
122
+ result <<~DOC
123
+ # 5 API Calls, 5 Results per page
124
+ users = client.users.list(per_page: 5).paginate_with_limit(25)
125
+ users.length
126
+ => 25
127
+ DOC
128
+ end
129
+
130
+ doc 'Pagination' do
131
+ desc 'Iterate through pages with a block'
132
+ example <<~DOC
133
+ client.users.list.paginate_with_limit(25) do |page|
134
+ puts page.length
135
+ end
136
+ DOC
137
+
138
+ result <<~DOC
139
+ # 5 API Calls, 5 Results per page
140
+ users = client.users.list(per_page: 5).paginate_with_limit(25)
141
+ users.length
142
+ => 25
143
+ DOC
144
+ end
145
+
146
+ doc 'Other' do
147
+ title 'Common Helpers'
148
+ markdown <<~DOC
149
+ The main api namespaces have a `help` and an `api_methods` methods. These will print out available methods and examples
150
+ DOC
151
+
152
+ result <<~DOC
153
+ client.help
154
+ client.api_methods
155
+
156
+ client.projects.api_methods
157
+ # => [:show, :list, :create]
158
+
159
+ client.users.help
160
+ Users
161
+ Available Methods
162
+ - list show
163
+
164
+ List
165
+ - client.users.list
166
+ - client.users.list(username: "rakan")
167
+ - client.users.list(search: "Sid")
168
+ - client.users.list(active: true)
169
+
170
+ User
171
+ - client.users.show(5)
172
+ - client.users.show(5)
173
+ DOC
174
+ end
175
+
176
+ doc 'Other' do
177
+ title 'Object IDs'
178
+
179
+ markdown <<~DOC
180
+ LabClient will automatically escape Project ID parameters that are namespaces. [More info](https://docs.gitlab.com/ee/api/README.html#namespaced-path-encoding)
181
+
182
+ This lets you pass Project ID parameters in several ways.
183
+ DOC
184
+
185
+ example <<~DOC
186
+ client.projects.show(16)
187
+ client.projects.show('16')
188
+ client.projects.show('group/project')
189
+ DOC
190
+ end
191
+
192
+ doc 'Other' do
193
+ desc 'Or pass LabClient Objects into API Calls'
194
+
195
+ example <<~DOC
196
+ project = client.projects.show(16)
197
+ client.commits.list project
198
+ # => Project Commits
199
+ DOC
200
+ end
201
+
202
+ doc 'Other' do
203
+ title 'Docker'
204
+ desc 'A docker image is created from master and can be used to execute snippets or load a quick pry session'
205
+
206
+ example 'docker run -it registry.gitlab.com/labclient/labclient'
207
+
208
+ result <<~DOC
209
+ # Run Container
210
+ docker run -it -e LABCLIENT_URL="https://labclient" -e LABCLIENT_TOKEN="token" registry.gitlab.com/labclient/labclient
211
+
212
+ client = LabClient::Client.new
213
+ client.users.list
214
+ DOC
215
+ end
216
+
217
+ doc 'Other' do
218
+ title 'Curl'
219
+ desc 'Sometimes you just wana have a curl example to test or send someone'
220
+ markdown <<~DOC
221
+ This will attempt to make a curl request from a generated request/response. **Note** this will include the private token!
222
+ DOC
223
+
224
+ example <<~DOC
225
+ list = client.users.list # Get output
226
+ list.curl # Show Curl
227
+ DOC
228
+
229
+ result <<~DOC
230
+ curl -k -H "Private-Token: super_secret_token" -H "Accept: application/json" "https://labclient/api/v4/users?"
231
+ DOC
232
+ end
233
+
234
+ doc 'Other' do
235
+ title 'Useful Links'
236
+ markdown <<~DOC
237
+ - [Gitlab API Docs](https://docs.gitlab.com/ee/api/)
238
+ - [API Authentication](https://docs.gitlab.com/ee/api/README.html#authentication)
239
+ DOC
240
+ end
241
+ end
242
+ end
243
+ # rubocop:enable Metrics/ClassLength
@@ -0,0 +1,115 @@
1
+ module LabClient
2
+ # Additional Pagination Support
3
+ # First page is always request prior to this class being instantiated
4
+ class PaginatedResponse
5
+ include CurlHelper
6
+
7
+ attr_accessor :client, :response, :array
8
+
9
+ def initialize(klass, response, client)
10
+ @klass = klass
11
+ @response = response
12
+ @client = client
13
+
14
+ @array = response.data.map { |entry| process_entry(entry, response) }
15
+
16
+ auto_paginate if client.settings[:paginate]
17
+ end
18
+
19
+ def inspect
20
+ @array
21
+ end
22
+
23
+ def method_missing(name, *args, &block)
24
+ if @array.respond_to?(name)
25
+ @array.send(name, *args, &block)
26
+ else
27
+ super
28
+ end
29
+ end
30
+
31
+ def help
32
+ puts <<~DOC
33
+ Pagination Helper Methods
34
+ auto_paginate
35
+ Automatically collect and return all results for a query. Accepts block
36
+ paginate_with_limit
37
+ Iterate through pages, but end when a certain limit is reached
38
+ each_page
39
+ Similar with auto_paginate, you can call each_page directly
40
+ DOC
41
+ end
42
+
43
+ def respond_to_missing?(method_name, include_private = false); end
44
+
45
+ def each_page(&block)
46
+ yield @array # This will eventually be the whole list
47
+ auto_paginate(&block)
48
+ end
49
+
50
+ def auto_paginate(&block)
51
+ yield @array if block_given?
52
+
53
+ loop do
54
+ break unless next_page?
55
+
56
+ next_page(&block)
57
+ end
58
+
59
+ @array
60
+ end
61
+
62
+ # Paginate to a limit
63
+ def paginate_with_limit(limit, &block)
64
+ yield @array if block_given?
65
+
66
+ loop do
67
+ break unless next_page?
68
+ break if @array.length >= limit
69
+
70
+ next_page(&block)
71
+ end
72
+
73
+ @array
74
+ end
75
+
76
+ # Check for and store next page
77
+ def next_page?
78
+ text = @response.headers['link']&.split(',')&.find { |x| x.include? 'next' }
79
+ return nil if text.nil?
80
+
81
+ @link = link_regex.match(text.strip)[1]
82
+
83
+ return false if @link.nil?
84
+
85
+ true
86
+ end
87
+
88
+ def link_regex
89
+ /<([^>]+)>; rel=\"([^\"]+)\"/
90
+ end
91
+
92
+ def next_page
93
+ return false unless next_page?
94
+
95
+ @response = client.http.request(:get, @link)
96
+
97
+ raise LabClient::Error.new(@response), @response.friendly_error unless @response.success?
98
+
99
+ results = process
100
+ @array.concat results
101
+ yield results if block_given?
102
+ end
103
+
104
+ # Create Class Objects
105
+ def process_entry(entry, entry_response)
106
+ @klass ? @klass.new(entry, entry_response, client) : entry
107
+ end
108
+
109
+ def process
110
+ @response.data.map do |entry|
111
+ process_entry(entry, @response)
112
+ end
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,34 @@
1
+ # Top namespace
2
+ module LabClient
3
+ # Specifics
4
+ class Pipelines < Common
5
+ doc 'Cancel' do
6
+ desc 'Cancel jobs in a pipeline. [Project ID, Pipeline ID]'
7
+ example 'client.pipelines.cancel(264, 7)'
8
+ result '#<Pipeline id: 10, ref: master, status: canceled>'
9
+ end
10
+
11
+ doc 'Cancel' do
12
+ desc 'Via Project'
13
+ example <<~DOC
14
+ project = client.projects.show(5)
15
+ project.pipeline_cancel(7)
16
+ DOC
17
+ end
18
+
19
+ doc 'Cancel' do
20
+ desc 'Via Pipeline'
21
+ example <<~DOC
22
+ pipeline = client.pipelines.show(264,7)
23
+ pipeline.cancel
24
+ DOC
25
+ end
26
+
27
+ def cancel(project_id, pipeline_id)
28
+ project_id = format_id(project_id)
29
+ pipeline_id = format_id(pipeline_id)
30
+
31
+ client.request(:post, "projects/#{project_id}/pipelines/#{pipeline_id}/cancel", Pipeline)
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,29 @@
1
+ # Top namespace
2
+ module LabClient
3
+ # Specifics
4
+ class Pipelines < Common
5
+ doc 'Create' do
6
+ desc 'Create a new pipeline. [Project ID]'
7
+ example 'client.pipelines.create(264, ref: :master)'
8
+ result '#<Pipeline id: 7, ref: master, status: success>'
9
+
10
+ markdown <<~DOC
11
+ | Attribute | Type | Required | Description |
12
+ | ref | string | yes | Reference to commit |
13
+ | variables | array | no | An array containing the variables available in the pipeline, matching the structure [{ 'key' => 'UPLOAD_TO_S3', 'variable_type' => 'file', 'value' => 'true' }] |
14
+ DOC
15
+ end
16
+
17
+ doc 'Create' do
18
+ desc 'Via Project'
19
+ example <<~DOC
20
+ project = client.projects.show(5)
21
+ project.pipeline_create(ref: :master)
22
+ DOC
23
+ end
24
+
25
+ def create(project_id, query)
26
+ client.request(:post, "projects/#{project_id}/pipeline", Pipeline, query)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,33 @@
1
+ # Top namespace
2
+ module LabClient
3
+ # Specifics
4
+ class Pipelines < Common
5
+ doc 'Delete' do
6
+ desc 'Delete a pipeline. [Project ID, Pipeline ID]'
7
+ example 'client.pipelines.delete(264, 7)'
8
+ end
9
+
10
+ doc 'Delete' do
11
+ desc 'Via Project'
12
+ example <<~DOC
13
+ project = client.projects.show(5)
14
+ project.pipeline_delete(7)
15
+ DOC
16
+ end
17
+
18
+ doc 'Delete' do
19
+ desc 'Via Pipeline'
20
+ example <<~DOC
21
+ pipeline = client.pipelines.show(264,7)
22
+ pipeline.delete
23
+ DOC
24
+ end
25
+
26
+ def delete(project_id, pipeline_id)
27
+ project_id = format_id(project_id)
28
+ pipeline_id = format_id(pipeline_id)
29
+
30
+ client.request(:delete, "projects/#{project_id}/pipelines/#{pipeline_id}")
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,50 @@
1
+ # Top namespace
2
+ module LabClient
3
+ # Specifics
4
+ class Pipelines < Common
5
+ doc 'List' do
6
+ desc 'List project pipelines. [Project ID, Hash]'
7
+ example 'client.pipelines.list(5)'
8
+ result '[#<Pipeline id: 6, ref: master, status: success>, ... ]'
9
+
10
+ markdown <<~DOC
11
+ | Attribute | Type | Required | Description |
12
+ |-----------|---------|----------|---------------------|
13
+ | scope | string | no | The scope of pipelines, one of: running, pending, finished, branches, tags |
14
+ | status | string | no | The status of pipelines, one of: running, pending, success, failed, canceled, skipped, created |
15
+ | ref | string | no | The ref of pipelines |
16
+ | sha | string | no | The SHA of pipelines |
17
+ | yaml_errors| boolean | no | Returns pipelines with invalid configurations |
18
+ | name| string | no | The name of the user who triggered pipelines |
19
+ | username| string | no | The username of the user who triggered pipelines |
20
+ | updated_after | datetime | no | Return pipelines updated after the specified date. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ |
21
+ | updated_before | datetime | no | Return pipelines updated before the specified date. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ |
22
+ | order_by| string | no | Order pipelines by id, status, ref, updated_at or user_id (default: id) |
23
+ | sort | string | no | Sort pipelines in asc or desc order (default: desc) |
24
+ DOC
25
+ end
26
+
27
+ doc 'List' do
28
+ desc 'Via Project'
29
+ example <<~DOC
30
+ project = client.projects.show(5)
31
+ project.pipelines
32
+ DOC
33
+ end
34
+
35
+ doc 'List' do
36
+ desc 'Filter by date'
37
+ example 'client.pipelines.list(264, updated_before: 10.day.ago)'
38
+ end
39
+
40
+ def list(project_id, query = {})
41
+ project_id = format_id(project_id)
42
+
43
+ %i[updated_after updated_before].each do |field|
44
+ query[field] = query[field].to_time.iso8601 if format_time?(query[field])
45
+ end
46
+
47
+ client.request(:get, "projects/#{project_id}/pipelines", Pipeline, query)
48
+ end
49
+ end
50
+ end