@@ -2121,7 +2121,7 @@ public GroupAccessToken createGroupAccessToken(Object groupIdOrPath, String name
2121
2121
GitLabApiForm formData = new GitLabApiForm ()
2122
2122
.withParam ("name" , name , true )
2123
2123
.withParam ("scopes" , Arrays .asList (scopes ))
2124
- .withParam ("expires_at" , expiresAt )
2124
+ .withParam ("expires_at" , ISO8601 . dateOnly ( expiresAt ) )
2125
2125
.withParam ("access_level" , accessLevel );
2126
2126
2127
2127
Response response = post (Response .Status .CREATED , formData , "groups" , getGroupIdOrPath (groupIdOrPath ), "access_tokens" );
@@ -2139,10 +2139,30 @@ public GroupAccessToken createGroupAccessToken(Object groupIdOrPath, String name
2139
2139
* @throws GitLabApiException if any exception occurs
2140
2140
*/
2141
2141
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" );
2143
2162
return (response .readEntity (GroupAccessToken .class ));
2144
2163
}
2145
2164
2165
+
2146
2166
/**
2147
2167
* Revoke a group access token.
2148
2168
*
0 commit comments