@@ -113,13 +113,13 @@ protected int getDefaultPerPage() {
113
113
protected GitLabApiClient getApiClient () {
114
114
return (gitLabApi .getApiClient ());
115
115
}
116
-
116
+
117
117
/**
118
118
* Encode a string to be used as in-path argument for a gitlab api request.
119
- *
119
+ *
120
120
* Standard URL encoding changes spaces to plus signs, but for arguments that are part of the path,
121
121
* like the :file_path in a "Get raw file" request, gitlab expects spaces to be encoded with %20.
122
- *
122
+ *
123
123
* @param s the string to encode
124
124
* @return encoded version of s with spaces encoded as %2F
125
125
* @throws GitLabApiException if encoding throws an exception
@@ -517,6 +517,7 @@ protected GitLabApiException handle(Exception thrown) {
517
517
return (new GitLabApiException (thrown ));
518
518
}
519
519
520
+
520
521
/**
521
522
* Creates a MultivaluedMap instance containing "page" and "per_page" params.
522
523
*
@@ -525,6 +526,20 @@ protected GitLabApiException handle(Exception thrown) {
525
526
* @return a MultivaluedMap instance containing "page" and "per_page" params
526
527
*/
527
528
protected MultivaluedMap <String , String > getPageQueryParams (int page , int perPage ) {
529
+ return (new GitLabApiForm ().withParam (PAGE_PARAM , page ).withParam (PER_PAGE_PARAM , perPage ).asMap ());
530
+ }
531
+
532
+ /**
533
+ * Creates a MultivaluedMap instance containing "page" and "per_page" params.
534
+ *
535
+ * @param page the page to get
536
+ * @param perPage the number of projects per page
537
+ * @param customAttributesEnabled enables customAttributes for this query
538
+ * @return a MultivaluedMap instance containing "page" and "per_page" params
539
+ */
540
+ protected MultivaluedMap <String , String > getPageQueryParams (int page , int perPage , boolean customAttributesEnabled ) {
541
+ if (customAttributesEnabled )
542
+ return (new GitLabApiForm ().withParam ("with_custom_attributes" , true ).withParam (PAGE_PARAM , page ).withParam (PER_PAGE_PARAM , perPage ).asMap ());
528
543
return (new GitLabApiForm ().withParam (PAGE_PARAM , page ).withParam (PER_PAGE_PARAM , perPage ).asMap ());
529
544
}
530
545
@@ -536,4 +551,16 @@ protected MultivaluedMap<String, String> getPageQueryParams(int page, int perPag
536
551
protected MultivaluedMap <String , String > getDefaultPerPageParam () {
537
552
return (new GitLabApiForm ().withParam (PER_PAGE_PARAM , getDefaultPerPage ()).asMap ());
538
553
}
554
+
555
+ /**
556
+ * Creates a MultivaluedMap instance containing the "per_page" param with the default value.
557
+ *
558
+ * @param customAttributesEnabled enables customAttributes for this query
559
+ * @return a MultivaluedMap instance containing the "per_page" param with the default value
560
+ */
561
+ protected MultivaluedMap <String , String > getDefaultPerPageParam (boolean customAttributesEnabled ) {
562
+ if (customAttributesEnabled )
563
+ return (new GitLabApiForm ().withParam ("with_custom_attributes" , true ).withParam (PER_PAGE_PARAM , getDefaultPerPage ()).asMap ());
564
+ return (new GitLabApiForm ().withParam (PER_PAGE_PARAM , getDefaultPerPage ()).asMap ());
565
+ }
539
566
}
0 commit comments