本文整理匯總了Java中io.swagger.annotations.ApiImplicitParam類的典型用法代碼示例。如果您正苦於以下問題:Java ApiImplicitParam類的具體用法?Java ApiImplicitParam怎麽用?Java ApiImplicitParam使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ApiImplicitParam類屬於io.swagger.annotations包,在下文中一共展示了ApiImplicitParam類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createAuthenticationToken
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
@ApiOperation(value = "授權", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query",name = "appName", value = "應用的名字", required = true,dataType = "String"),
@ApiImplicitParam(paramType = "query",name = "vq",value = "vq",required = true,dataType = "String"),
@ApiImplicitParam(paramType = "query",name = "device",value = "設備的名字",required = true,dataType = "String")})
@RequestMapping(value = "${jwt.route.authentication.path}", method = RequestMethod.POST)
public ResponseEntity<?> createAuthenticationToken(String appName,String vq, Device device) throws AuthenticationException {
logger.info("應用:" + appName + " 正在授權!");
App app = appRepository.findFirstByAppname(appName);
if (app == null) {
return ResponseEntity.ok(new ErrorReporter(1, "未找到應用" + appName));
}
YibanOAuth yibanOAuth = new YibanOAuth(vq, app);
yibanOAuth.dealYibanOauth();
if (yibanOAuth.isHasError() == false) {
upcYbUserFactory.createUser(yibanOAuth.getYibanBasicUserInfo());
String ybid = String.valueOf(yibanOAuth.getYibanBasicUserInfo().visit_user.userid);
String ybtocken = yibanOAuth.getYibanBasicUserInfo().visit_oauth.access_token;
logger.info("ybtocken: " + ybtocken);
final JwtUser userDetails = (JwtUser) userDetailsService.loadUserByUsername(ybid);
final String token = jwtTokenUtil.generateToken(userDetails, ybtocken,appName, device);
logger.info("發放token:" + token);
return ResponseEntity.ok(new JwtAuthenticationResponse(token));
} else {
return ResponseEntity.ok(new ErrorReporter(2, "解析vq失敗,可能是由於密鑰長度不匹配"));
}
}
示例2: CreatePosts
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
@ApiOperation("發帖接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "content", value = "帖子內容", dataType = "String"),
@ApiImplicitParam(name = "title", value = "帖子標題", dataType = "String"),
@ApiImplicitParam(name = "token", value = "用戶令牌", dataType = "String"),
@ApiImplicitParam(name = "labelId", value = "標簽ID", dataType = "Integer")
})
@PostMapping
public QuarkResult CreatePosts(Posts posts, String token, Integer labelId) {
QuarkResult result = restProcessor(() -> {
if (token == null) return QuarkResult.warn("請先登錄!");
User userbytoken = userService.getUserByToken(token);
if (userbytoken == null) return QuarkResult.warn("用戶不存在,請先登錄!");
User user = userService.findOne(userbytoken.getId());
if (user.getEnable() != 1) return QuarkResult.warn("用戶處於封禁狀態!");
postsService.savePosts(posts, labelId, user);
return QuarkResult.ok();
});
return result;
}
示例3: getParticipantFromCGOR
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
@ApiOperation(value = "getParticipantFromCGOR", nickname = "getParticipantFromCGOR")
@RequestMapping(value = "/CISConnector/getParticipantFromCGOR/{cgorName}", method = RequestMethod.GET)
@ApiImplicitParams({
@ApiImplicitParam(name = "cgorName", value = "the CGOR name", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "organisation", value = "the Organisation name", required = true, dataType = "String", paramType = "query")
})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success", response = Participant.class),
@ApiResponse(code = 400, message = "Bad Request", response = Participant.class),
@ApiResponse(code = 500, message = "Failure", response = Participant.class)})
public ResponseEntity<Participant> getParticipantFromCGOR(@PathVariable String cgorName, @QueryParam("organisation") String organisation) {
log.info("--> getParticipantFromCGOR: " + cgorName);
Participant participant;
try {
participant = connector.getParticipantFromCGOR(cgorName, organisation);
} catch (CISCommunicationException e) {
log.error("Error executing the request: Communication Error" , e);
participant = null;
}
HttpHeaders responseHeaders = new HttpHeaders();
log.info("getParticipantFromCGOR -->");
return new ResponseEntity<Participant>(participant, responseHeaders, HttpStatus.OK);
}
示例4: createParameterInstance
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
private static Parameter createParameterInstance(ApiImplicitParam paramAnnotation) {
switch (paramAnnotation.paramType()) {
case "path":
return new PathParameter();
case "query":
return new QueryParameter();
case "body":
return new BodyParameter();
case "header":
return new HeaderParameter();
case "form":
return new FormParameter();
case "cookie":
return new CookieParameter();
default:
throw new Error("not support paramType " + paramAnnotation.paramType());
}
}
示例5: add
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
/**
* 新增域
*/
@RequestMapping(method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "新增域信息", notes = "添加新的域信息,新增的域默認授權給創建人")
@ApiImplicitParam(name = "domain_id", value = "域編碼", required = true, dataType = "String")
public String add(HttpServletResponse response, HttpServletRequest request) {
DomainEntity domainEntity = parse(request);
RetMsg retMsg = domainService.add(domainEntity);
if (retMsg.checkCode()) {
return Hret.success(retMsg);
}
response.setStatus(retMsg.getCode());
return Hret.error(retMsg);
}
示例6: GetPosts
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
@ApiOperation("翻頁查詢帖子接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "search", value = "查詢條件", dataType = "int"),
@ApiImplicitParam(name = "type", value = "帖子類型[top : good : ]", dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "頁碼[從1開始]", dataType = "int"),
@ApiImplicitParam(name = "length", value = "返回結果數量[默認20]", dataType = "int")
})
@GetMapping()
public QuarkResult GetPosts(
@RequestParam(required = false, defaultValue = "") String search,
@RequestParam(required = false, defaultValue = "") String type,
@RequestParam(required = false, defaultValue = "1") int pageNo,
@RequestParam(required = false, defaultValue = "20") int length) {
QuarkResult result = restProcessor(() -> {
if (!type.equals("good") && !type.equals("top") && !type.equals(""))
return QuarkResult.error("類型錯誤!");
Page<Posts> page = postsService.getPostsByPage(type, search, pageNo - 1, length);
return QuarkResult.ok(page.getContent(), page.getTotalElements(), page.getNumberOfElements());
});
return result;
}
示例7: GetPostsDetail
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
@ApiOperation("翻頁帖子詳情與回複接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "postsid", value = "帖子的id", dataType = "int"),
@ApiImplicitParam(name = "pageNo", value = "頁碼[從1開始]", dataType = "int"),
@ApiImplicitParam(name = "length", value = "返回結果數量[默認20]", dataType = "int")
})
@GetMapping("/detail/{postsid}")
public QuarkResult GetPostsDetail(
@PathVariable("postsid") Integer postsid,
@RequestParam(required = false, defaultValue = "1") int pageNo,
@RequestParam(required = false, defaultValue = "20") int length) {
QuarkResult result = restProcessor(() -> {
HashMap<String, Object> map = new HashMap<>();
Posts posts = postsService.findOne(postsid);
if (posts == null) return QuarkResult.error("帖子不存在");
map.put("posts", posts);
Page<Reply> page = replyService.getReplyByPage(postsid, pageNo - 1, length);
map.put("replys", page.getContent());
return QuarkResult.ok(map, page.getTotalElements(), page.getNumberOfElements());
});
return result;
}
示例8: GetPostsByLabel
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
@ApiOperation("根據labelId獲取帖子接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "labelid", value = "標簽的id", dataType = "int"),
@ApiImplicitParam(name = "pageNo", value = "頁碼[從1開始]", dataType = "int"),
@ApiImplicitParam(name = "length", value = "返回結果數量[默認20]", dataType = "int"),
})
@GetMapping("/label/{labelid}")
public QuarkResult GetPostsByLabel(
@PathVariable("labelid") Integer labelid,
@RequestParam(required = false, defaultValue = "1") int pageNo,
@RequestParam(required = false, defaultValue = "20") int length) {
QuarkResult result = restProcessor(() -> {
Label label = labelService.findOne(labelid);
if (label == null) return QuarkResult.error("標簽不存在");
Page<Posts> page = postsService.getPostsByLabel(label, pageNo - 1, length);
return QuarkResult.ok(page.getContent(), page.getTotalElements(), page.getNumberOfElements());
});
return result;
}
示例9: checkUserName
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
@ApiOperation("注冊接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "email", value = "用戶郵箱",dataType = "String"),
@ApiImplicitParam(name = "username", value = "用戶名稱",dataType = "String"),
@ApiImplicitParam(name = "password", value = "用戶密碼",dataType = "String")
})
@PostMapping
public QuarkResult checkUserName(String email,String username,String password) {
QuarkResult result = restProcessor(() -> {
if (!userService.checkUserName(username))
return QuarkResult.warn("用戶名已存在,請重新輸入");
if (!userService.checkUserEmail(email))
return QuarkResult.warn("用戶郵箱已存在,請重新輸入");
else
userService.createUser(email,username,password);
return QuarkResult.ok();
});
return result;
}
示例10: Login
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
@ApiOperation("登錄接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "email", value = "用戶郵箱",dataType = "String"),
@ApiImplicitParam(name = "password", value = "用戶密碼",dataType = "String")
})
@PostMapping("/login")
public QuarkResult Login(String email,String password) {
QuarkResult result = restProcessor(() -> {
User loginUser = userService.findByEmail(email);
if (loginUser == null)
return QuarkResult.warn("用戶郵箱不存在,請重新輸入");
if (!loginUser.getPassword().equals(DigestUtils.md5DigestAsHex(password.getBytes())))
return QuarkResult.warn("用戶密碼錯誤,請重新輸入");
String token = userService.LoginUser(loginUser);
return QuarkResult.ok(token);
});
return result;
}
示例11: getUserAndMessageByToken
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
@ApiOperation("根據Token獲取用戶的信息與通知消息數量")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "發送給用戶的唯一令牌",dataType = "String"),
})
@GetMapping("/message/{token}")
public QuarkResult getUserAndMessageByToken(@PathVariable String token){
QuarkResult result = restProcessor(() -> {
HashMap<String, Object> map = new HashMap<>();
User user = userService.getUserByToken(token);
if (user == null) return QuarkResult.warn("session過期,請重新登錄");
long count = notificationService.getNotificationCount(user.getId());
map.put("user",user);
map.put("messagecount",count);
return QuarkResult.ok(map);
});
return result;
}
示例12: updateUser
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
@ApiOperation("根據Token修改用戶的信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "發送給用戶的唯一令牌",dataType = "String"),
@ApiImplicitParam(name = "username", value = "要修改的用戶名",dataType = "String"),
@ApiImplicitParam(name = "signature", value = "用戶簽名",dataType = "String"),
@ApiImplicitParam(name = "sex", value = "要修改的性別:數值0為男,1為女",dataType = "int"),
})
@PutMapping("/{token}")
public QuarkResult updateUser(@PathVariable("token") String token,String username,String signature,Integer sex){
QuarkResult result = restProcessor(() -> {
if (!userService.checkUserName(username)) return QuarkResult.warn("用戶名重複!");
if (sex != 0 && sex != 1) return QuarkResult.warn("性別輸入錯誤!");
userService.updateUser(token, username, signature, sex);
return QuarkResult.ok();
});
return result;
}
示例13: getUserById
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
@ApiOperation("根據用戶ID獲取用戶詳情與用戶最近發布的十個帖子[主要用於用戶主頁展示]")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "用戶的id", dataType = "int")
})
@GetMapping("/detail/{userid}")
public QuarkResult getUserById(@PathVariable("userid") Integer userid){
QuarkResult result = restProcessor(() -> {
User user = userService.findOne(userid);
if (user == null || userid == null) return QuarkResult.warn("用戶不存在");
List<Posts> postss = postsService.getPostsByUser(user);
HashMap<String, Object> map = new HashMap<>();
map.put("posts",postss);
map.put("user",user);
return QuarkResult.ok(map);
});
return result;
}
示例14: getOrganisationByName
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
@ApiOperation(value = "getOrganisationByName", nickname = "getOrganisationByName")
@RequestMapping(value = "/CISConnector/getOrganisationByName/{organisation}", method = RequestMethod.GET)
@ApiImplicitParams({
@ApiImplicitParam(name = "organisation", value = "the Organisation name", required = true, dataType = "String", paramType = "path")
})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success", response = ResponseEntity.class),
@ApiResponse(code = 400, message = "Bad Request", response = ResponseEntity.class),
@ApiResponse(code = 500, message = "Failure", response = ResponseEntity.class)})
public ResponseEntity<Organisation> getOrganisationByName(@PathVariable String organisation) throws CISCommunicationException {
log.info("--> getOrganisationByName: " + organisation);
Organisation organisationRes = null;
try {
organisationRes = connector.getOrganisationByName(organisation);
} catch (CISCommunicationException e) {
log.error("Error executing the request: Communication Error" , e);
organisationRes = null;
}
HttpHeaders responseHeaders = new HttpHeaders();
log.info("getOrganisationByName -->");
return new ResponseEntity<Organisation>(organisationRes, responseHeaders, HttpStatus.OK);
}
示例15: CreateReply
import io.swagger.annotations.ApiImplicitParam; //導入依賴的package包/類
@ApiOperation("發布回複接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "content", value = "回複內容", dataType = "String"),
@ApiImplicitParam(name = "token", value = "用戶令牌", dataType = "String"),
@ApiImplicitParam(name = "postsId", value = "帖子ID", dataType = "Integer")
})
@PostMapping
public QuarkResult CreateReply(Reply reply,Integer postsId,String token){
QuarkResult result = restProcessor(() -> {
if (token == null) return QuarkResult.warn("請先登錄!");
User userbytoken = userService.getUserByToken(token);
if (userbytoken == null) return QuarkResult.warn("用戶不存在,請先登錄!");
User user = userService.findOne(userbytoken.getId());
if (user.getEnable() != 1) return QuarkResult.warn("用戶處於封禁狀態!");
replyService.saveReply(reply, postsId, user);
return QuarkResult.ok();
});
return result;
}