@@ -2438,4 +2438,84 @@ public GroupHook addWebhook(Object groupIdOrPath, GroupHookParams groupHookParam
2438
2438
Response .Status .CREATED , groupHookParams .getForm (), "groups" , getGroupIdOrPath (groupIdOrPath ), "hooks" );
2439
2439
return (response .readEntity (GroupHook .class ));
2440
2440
}
2441
+
2442
+ /**
2443
+ * Get all uploads of the group sorted by created_at in descending order.
2444
+ *
2445
+ * You must have at least the Maintainer role to use this endpoint.
2446
+ *
2447
+ * <pre><code>GitLab Endpoint: GET /groups/:id/uploads</code></pre>
2448
+ *
2449
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance, required
2450
+ * @return list of uploaded files
2451
+ * @throws GitLabApiException if any exception occurs
2452
+ */
2453
+ public List <UploadedFile > getUploadFiles (Object groupIdOrPath ) throws GitLabApiException {
2454
+ Response response = get (Response .Status .OK , null , "projects" , getGroupIdOrPath (groupIdOrPath ), "uploads" );
2455
+ return (response .readEntity (new GenericType <List <UploadedFile >>() {}));
2456
+ }
2457
+
2458
+ /**
2459
+ * Uploads a file to the specified group to be used in an issue or merge request description, or a comment.
2460
+ *
2461
+ * <pre><code>GitLab Endpoint: POST /groups/:id/uploads</code></pre>
2462
+ *
2463
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance, required
2464
+ * @param fileToUpload the File instance of the file to upload, required
2465
+ * @return a FileUpload instance with information on the just uploaded file
2466
+ * @throws GitLabApiException if any exception occurs
2467
+ */
2468
+ public FileUpload uploadFile (Object groupIdOrPath , File fileToUpload ) throws GitLabApiException {
2469
+ return (uploadFile (groupIdOrPath , fileToUpload , null ));
2470
+ }
2471
+
2472
+ /**
2473
+ * Uploads a file to the specified group to be used in an issue or merge request description, or a comment.
2474
+ *
2475
+ * <pre><code>GitLab Endpoint: POST /groups/:id/uploads</code></pre>
2476
+ *
2477
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance, required
2478
+ * @param fileToUpload the File instance of the file to upload, required
2479
+ * @param mediaType unused; will be removed in the next major version
2480
+ * @return a FileUpload instance with information on the just uploaded file
2481
+ * @throws GitLabApiException if any exception occurs
2482
+ */
2483
+ public FileUpload uploadFile (Object groupIdOrPath , File fileToUpload , String mediaType ) throws GitLabApiException {
2484
+ Response response = upload (
2485
+ Response .Status .CREATED ,
2486
+ "file" ,
2487
+ fileToUpload ,
2488
+ mediaType ,
2489
+ "groups" ,
2490
+ getGroupIdOrPath (groupIdOrPath ),
2491
+ "uploads" );
2492
+ return (response .readEntity (FileUpload .class ));
2493
+ }
2494
+
2495
+ /**
2496
+ * Uploads some data in an {@link InputStream} to the specified group,
2497
+ * to be used in an issue or merge request description, or a comment.
2498
+ *
2499
+ * <pre><code>GitLab Endpoint: POST /groups/:id/uploads</code></pre>
2500
+ *
2501
+ * @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance, required
2502
+ * @param inputStream the data to upload, required
2503
+ * @param filename The filename of the file to upload
2504
+ * @param mediaType unused; will be removed in the next major version
2505
+ * @return a FileUpload instance with information on the just uploaded file
2506
+ * @throws GitLabApiException if any exception occurs
2507
+ */
2508
+ public FileUpload uploadFile (Object groupIdOrPath , InputStream inputStream , String filename , String mediaType )
2509
+ throws GitLabApiException {
2510
+ Response response = upload (
2511
+ Response .Status .CREATED ,
2512
+ "file" ,
2513
+ inputStream ,
2514
+ filename ,
2515
+ mediaType ,
2516
+ "groups" ,
2517
+ getGroupIdOrPath (groupIdOrPath ),
2518
+ "uploads" );
2519
+ return (response .readEntity (FileUpload .class ));
2520
+ }
2441
2521
}
0 commit comments