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