|
|
@@ -1,89 +1,25 @@
|
|
|
package cn.seecoder.seecoderportalserver.service;
|
|
|
|
|
|
+import com.nju.edu.gitlab.SeecoderGitlabClient;
|
|
|
+import com.nju.edu.gitlab.SeecoderGitlabException;
|
|
|
+import com.nju.edu.gitlab.vo.GitlabUserVO;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
+
|
|
|
/**
|
|
|
* @author kunduin
|
|
|
*/
|
|
|
+@Service
|
|
|
public class GitlabService {
|
|
|
|
|
|
-// public GitlabService.Response createUser(String userId, String username, String password, String email) {
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
- public static class User {
|
|
|
- private String userId;
|
|
|
- private String username;
|
|
|
- private String password;
|
|
|
- private String email;
|
|
|
-
|
|
|
- public String getUserId() {
|
|
|
- return userId;
|
|
|
- }
|
|
|
-
|
|
|
- public void setUserId(String userId) {
|
|
|
- this.userId = userId;
|
|
|
- }
|
|
|
-
|
|
|
- public String getUsername() {
|
|
|
- return username;
|
|
|
- }
|
|
|
-
|
|
|
- public void setUsername(String username) {
|
|
|
- this.username = username;
|
|
|
- }
|
|
|
-
|
|
|
- public String getPassword() {
|
|
|
- return password;
|
|
|
- }
|
|
|
-
|
|
|
- public void setPassword(String password) {
|
|
|
- this.password = password;
|
|
|
- }
|
|
|
+ private final SeecoderGitlabClient client;
|
|
|
|
|
|
- public String getEmail() {
|
|
|
- return email;
|
|
|
- }
|
|
|
-
|
|
|
- public void setEmail(String email) {
|
|
|
- this.email = email;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public String toString() {
|
|
|
- return "User{" +
|
|
|
- "userId='" + userId + '\'' +
|
|
|
- ", username='" + username + '\'' +
|
|
|
- ", password='" + password + '\'' +
|
|
|
- ", email='" + email + '\'' +
|
|
|
- '}';
|
|
|
- }
|
|
|
+ public GitlabService(@Value("${seec.gitlab.url}") String url) {
|
|
|
+ this.client = new SeecoderGitlabClient(url, "");
|
|
|
}
|
|
|
|
|
|
- public static class Response{
|
|
|
- private int err;
|
|
|
- private Object res;
|
|
|
-
|
|
|
- public int getErr() {
|
|
|
- return err;
|
|
|
- }
|
|
|
-
|
|
|
- public void setErr(int err) {
|
|
|
- this.err = err;
|
|
|
- }
|
|
|
-
|
|
|
- public Object getRes() {
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- public void setRes(Object res) {
|
|
|
- this.res = res;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public String toString() {
|
|
|
- return "Response{" +
|
|
|
- "err=" + err +
|
|
|
- ", res=" + res +
|
|
|
- '}';
|
|
|
- }
|
|
|
+ public GitlabUserVO createGitlabUser(int userId, String username, String password, String email) throws SeecoderGitlabException {
|
|
|
+ return client.createGitlabUser(userId, username, password, email);
|
|
|
}
|
|
|
}
|