@@ -113,13 +113,13 @@ protected int getDefaultPerPage() {
113113 protected GitLabApiClient getApiClient () {
114114 return (gitLabApi .getApiClient ());
115115 }
116-
116+
117117 /**
118118 * Encode a string to be used as in-path argument for a gitlab api request.
119- *
119+ *
120120 * Standard URL encoding changes spaces to plus signs, but for arguments that are part of the path,
121121 * like the :file_path in a "Get raw file" request, gitlab expects spaces to be encoded with %20.
122- *
122+ *
123123 * @param s the string to encode
124124 * @return encoded version of s with spaces encoded as %2F
125125 * @throws GitLabApiException if encoding throws an exception
@@ -517,6 +517,7 @@ protected GitLabApiException handle(Exception thrown) {
517517 return (new GitLabApiException (thrown ));
518518 }
519519
520+
520521 /**
521522 * Creates a MultivaluedMap instance containing "page" and "per_page" params.
522523 *
@@ -525,6 +526,20 @@ protected GitLabApiException handle(Exception thrown) {
525526 * @return a MultivaluedMap instance containing "page" and "per_page" params
526527 */
527528 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 ());
528543 return (new GitLabApiForm ().withParam (PAGE_PARAM , page ).withParam (PER_PAGE_PARAM , perPage ).asMap ());
529544 }
530545
@@ -536,4 +551,16 @@ protected MultivaluedMap<String, String> getPageQueryParams(int page, int perPag
536551 protected MultivaluedMap <String , String > getDefaultPerPageParam () {
537552 return (new GitLabApiForm ().withParam (PER_PAGE_PARAM , getDefaultPerPage ()).asMap ());
538553 }
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+ }
539566}
0 commit comments