@@ -2121,7 +2121,7 @@ public GroupAccessToken createGroupAccessToken(Object groupIdOrPath, String name
21212121 GitLabApiForm formData = new GitLabApiForm ()
21222122 .withParam ("name" , name , true )
21232123 .withParam ("scopes" , Arrays .asList (scopes ))
2124- .withParam ("expires_at" , expiresAt )
2124+ .withParam ("expires_at" , ISO8601 . dateOnly ( expiresAt ) )
21252125 .withParam ("access_level" , accessLevel );
21262126
21272127 Response response = post (Response .Status .CREATED , formData , "groups" , getGroupIdOrPath (groupIdOrPath ), "access_tokens" );
@@ -2139,10 +2139,30 @@ public GroupAccessToken createGroupAccessToken(Object groupIdOrPath, String name
21392139 * @throws GitLabApiException if any exception occurs
21402140 */
21412141 public GroupAccessToken rotateGroupAccessToken (Object groupIdOrPath , Long tokenId ) throws GitLabApiException {
2142- Response response = post (Response .Status .OK , (Form )null , "groups" , getGroupIdOrPath (groupIdOrPath ), "access_tokens" , tokenId , "rotate" );
2142+ return rotateGroupAccessToken (groupIdOrPath , tokenId , null );
2143+ }
2144+
2145+
2146+ /**
2147+ * Rotate a group access token. Revokes the previous token and creates a new token that expires in one week.
2148+ *
2149+ * <pre><code>GitLab Endpoint: POST /groups/:id/access_tokens/:token_id/rotate</code></pre>
2150+ *
2151+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
2152+ * @param tokenId ID of the group access token
2153+ * @param expiresAt Expiration date of the access token
2154+ * @return the updated GroupAccessToken instance
2155+ * @throws GitLabApiException if any exception occurs
2156+ */
2157+ public GroupAccessToken rotateGroupAccessToken (Object groupIdOrPath , Long tokenId , Date expiresAt ) throws GitLabApiException {
2158+ GitLabApiForm formData = new GitLabApiForm ()
2159+ .withParam ("expires_at" , ISO8601 .dateOnly (expiresAt ));
2160+
2161+ Response response = post (Response .Status .OK , formData , "groups" , getGroupIdOrPath (groupIdOrPath ), "access_tokens" , tokenId , "rotate" );
21432162 return (response .readEntity (GroupAccessToken .class ));
21442163 }
21452164
2165+
21462166 /**
21472167 * Revoke a group access token.
21482168 *
0 commit comments