import 'dart:io'; import 'package:dio/dio.dart' hide Headers; import 'package:retrofit/retrofit.dart'; import 'package:sport/bean/UpdateInfo.dart'; import 'package:sport/bean/comment.dart'; import 'package:sport/bean/comment_post.dart'; import 'package:sport/bean/feedback_category.dart'; import 'package:sport/bean/forum.dart'; import 'package:sport/bean/game.dart'; import 'package:sport/bean/game_record.dart'; import 'package:sport/bean/game_record_sum.dart'; import 'package:sport/bean/image.dart'; import 'package:sport/bean/notice.dart'; import 'package:sport/bean/post.dart'; import 'package:sport/bean/rank_game_info.dart'; import 'package:sport/bean/rank_info.dart'; import 'package:sport/bean/share_info.dart'; import 'package:sport/bean/shop.dart'; import 'package:sport/bean/sport_detail.dart'; import 'package:sport/bean/sport_index.dart'; import 'package:sport/bean/sport_step.dart'; import 'package:sport/bean/sport_target.dart'; import 'package:sport/bean/sport_target_index.dart'; import 'package:sport/bean/sport_target_record.dart'; import 'package:sport/bean/sport_target_today.dart'; import 'package:sport/bean/user_friend.dart'; import 'package:sport/bean/user_info.dart'; import 'package:sport/services/api/resp.dart'; import 'package:sport/bean/message.dart'; part 'rest_client.g.dart'; @RestApi() abstract class RestClient { factory RestClient(Dio dio, {String baseUrl}) = _RestClient; @GET("/app/checkUpdate") Future> checkUpdate(@Query("version") String version); @GET("/user/info") Future> getUserInfo(@Query("id") String uid, {@DioOptions() Options options}); @GET("/user/countNameCard") Future> getCountNameCard(); // ********************** 运动首页相关 ***************************** @GET("/sport/index") Future> getSportIndex(); @GET("/sport/detail") Future> getSportDetail(); @POST("/sportRecord/addGame") Future> postAddGame( @Query("game_id") int gameId, @Query("score") double score, @Query("duration") int duration, @Query("consume") int consume, @Query("screen") int screen, @Query("jump_count") int jumpCount, @Query("crouch_count") int crouchCount, @Query("step_count") int stepCount, @Query("distance") int distance); @GET("/sportTarget/all") Future> getSportTargetAll(); @GET("/sportTarget/setold") Future> setSportTarget(@Query("id") int id); @GET("/sportTarget/set") Future> setSportTargetToday(@Query("type") String type,{@Query("consume") int consume, @Query("duration_minute") int durationMinute}); @GET("/sportTarget/setCustom") Future> setSportTargetCustom(@Query("duration") int duration, @Query("consume") int consume); @GET("/sportTarget/del") Future delSportTarget(); @GET("/sportTarget/my") Future> getSportTargetMy(); @GET("/sportTarget/index") Future> getSportTargetIndex(); @GET("/sportTarget/records") Future> getSportTargetRecord(@Query("year") int year, @Query("month") int month); @FormUrlEncoded() @POST("/sportTarget/reward") Future> sportTargetReward(@Query("id") int id); @GET("/sportRecord/listOneDay") Future> getSportRecordListOneDay(@Query("date") String date); @GET("/sportRecord/listByDay") Future> getSportRecordListByDay(@Query("begin") String begin, @Query("end") String end); @GET("/sportRecord/listByMonth") Future> getSportRecordListByMonth(@Query("year") int year); @GET("/sportRecord/listByYear") Future> getSportRecordListByYear(); @GET("/sportRecord/list") Future> getSportRecordList(@Query("game_id") int gameId, {@Query("page") int page}); @FormUrlEncoded() @POST("/stepRecord/addDaily") Future> addDaily({@Query("step") int step, @Query("distance") int distance, @Query("time") String time, @Field("data") String data}); @GET("/stepRecord/listOneDay") Future> getStepRecordListOneDay(@Query("date") String date); @GET("/stepRecord/listByDay") Future> getStepRecordListByDay(@Query("begin") String begin, @Query("end") String end); @GET("/stepRecord/listByMonth") Future> getStepRecordListByMonth(@Query("year") int year); @GET("/stepRecord/listByYear") Future> getStepRecordListByYear(); @GET("/gameRecord/sum") Future> getGameRecordSum(); @GET("/gameRecord/game") Future> getGameRecord(@Query("id") int gameId); @GET("/rank/game") Future> getRankInfo(@Query("game_id") String gameId, {@Query("province_id") int provinceId, @Query("city_id") int cityId, @Query("district_id") int districtId}); // ********************** 社区相关 ***************************** @GET("/forum/index") Future> getForumIndex(); @GET("/forum/list") Future> getPostList({@Query("forumId") String forumId, @Query("p") int page, @Query("isGood") int isGood, @Query("kw") String kw ,@Query("isOfficial") String isOfficial,}); @GET("/forum/listByOfficial") Future> getPostListByOfficial({@Query("forumId") String forumId, @Query("p") int page, @Query("limit") int limit, @Query("sortBy") String sortBy,@Query("isOfficial") String isOfficial}); @GET("/forum/listByHot") Future> getPostListByHot({@Query("forumId") String forumId,@Query("p") int page,@Query("isOfficial") String isOfficial, @DioOptions() Options options}); @GET("/forum/listByUser") Future> getPostListByUser(@Query("uid") String uid, {@Query("forumId") String forumId, @Query("p") int page, @Query("sortBy") String sortBy, @Query("removeTop") int removeTop,@Query("isOfficial") String isOfficial}); @GET("/forum/listByFollow") Future> getPostListByFollow(@Query("uid") String uid, {@Query("forumId") String forumId,@Query("p") int page, @Query("limit") int limit, @Query("testuid") int testuid, @Query("sortBy") String sortBy,@Query("isOfficial") String isOfficial,@DioOptions() Options options}); @GET("/forum/subjectDetail") Future> getPostDetail(@Query("subjectId") String subjectId); @GET("/forum/comments") Future> getPostComments(@Query("subjectId") String subjectId, {@Query("p") int page, @Query("sortBy") String sortBy}); @GET("/forum/subComments") Future> getPostCommentSubs(@Query("parentCommentId") String parentCommentId, {@Query("p") int page, @Query("sortBy") String sortBy}); @GET("/forum/commentsFromId") Future> getPostCommentsFromId(@Query("commentId") String commentId, {@Query("limit") int limit, @Query("sortBy") String sortBy}); @GET("/forum/hotSearchWords") Future> getSearchWords(); @POST("/forum/like") Future> postForumLike(@Query("objectId") String objectId, @Query("fieldName") String fieldName); @POST("/forum/unlike") Future> postForumUnLike(@Query("objectId") String objectId, @Query("fieldName") String fieldName); @POST("/forum/delSubject") Future> postDelSubject(@Query("subjectId") String subjectId); @POST("/forum/delComment") Future> postDelComment(@Query("commentId") String commentId); @POST("/forum/report") Future> postForumReport({@Query("subjectId") String subjectId, @Query("commentId") String commentId, @Query("content") String content,@Query("userId") int userId}); @POST("/forum/blockUser") Future> postForumBlockUser(@Query("uid") String uid); @POST("/forum/unblockUser") Future> postForumUnBlockUser(@Query("uid") String uid); @GET("/forum/myBlockUsers") Future> getMyBlockUsers(); @POST("/forum/blockObject") Future> postForumBlockObject(@Query("objectId") String objectId, @Query("for") String forName); @POST("/forum/postComment") Future> postForumComment(@Query("subjectId") String subjectId, @Query("content") String content, {@Query("parentCommentId") String parentCommentId, @Query("toCommentId") String toCommentId}); @POST("/forum/post") Future>> postForum(@Query("forumId") String forumId, @Query("content") String content, {@Query("images") String images, @Query("quoteSubjectId") String quoteSubjectId, @Query("quoteCommentId") String quoteCommentId, @Query("quoteData") String quoteData, CancelToken cancelToken}); @POST("/forum/setUserTopSubjects") Future> setUserTopSubjects(@Query("subjectIdList") String subjectIdList); @POST("/forum/unsetUserTopSubjects") Future> unsetUserTopSubjects(@Query("subjectIdList") String subjectIdList); @GET("/forum/userTopSubjects") Future> getPostUserTopSubjects(@Query("uid") String uid, {@Query("forumId") String forumId, @Query("p") int page, @Query("sortBy") String sortBy}); @POST("/forum/follow") Future> userFollow({@Query("uid") int uid, @Query("groupId") String groupId, @Query("groupName") String groupName}); @POST("/forum/unfollow") Future> userUnFollow({@Query("uid") int uid}); @POST("/forum/ignoreFollow") Future> userIgnoreFollow({@Query("uid") int uid}); @GET("/forum/followList") Future> userFollowList({@Query("groupId") String groupId, @Query("kw") String kw, @Query("p") int page, @Query("limit") int limit = 50}); @GET("/forum/fansList") Future> userFansList({@Query("groupId") String groupId, @Query("kw") String kw, @Query("p") int page, @Query("limit") int limit = 50}); @GET("/forum/friends") Future> userFriends({@Query("groupId") String groupId, @Query("kw") String kw, @Query("p") int page, @Query("limit") int limit = 50 ,@Query("test") String test,}); @GET("/forum/friends") Future> userFriendsTest({@Query("groupId") String groupId, @Query("kw") String kw, @Query("p") int page, @Query("limit") int limit = 50 ,@Query("test") String test,}); @GET("/user/search") Future> userSearch({@Query("kw") String kw, @Query("p") int page, @Query("limit") int limit = 20}); @POST("/user/newFriendCode") Future getNewFriendCode({@Query("forever") int forever, @Query("forceUpate") int forceUpdate,}); @POST("/user/newFriend") Future> getNewFriend(@Query("code") String code); @POST("/share/forwardSubject") Future> shareForwardSubject(@Query("subject_id") int subjectId,@Query("user_id") int userId,); @POST("/message/receive") Future> getMessageForPoll({@Query("cur_id") int curId}); @POST("/user/FetchFriendsRequest") Future> getFriendRequest(); @POST("/user/RejectFriend") Future> postRejectFriend(@Query("uid") int uid); @POST("/user/AcceptFriend") Future postAcceptFriend(@Query("uid") int uid); @POST("/user/isFriend") Future> postIsFriend(@Query("uid") int uid); // ********************** 聊天相关 ***************************** @POST("/chat/index") Future> getChatIndex(); @POST("/chat/user") Future> getChatUser(@Query("user_id") int userId,{@Query("begin_id") int beginId}); @POST("/chat/send") Future> postChatSend(@Query("user_id") int userId,@Query("type") String type,@Query("data") String data,); @POST("/chat/upload") @Headers({ "content-type": "multipart/form-data", }) Future postChatUpload(@Part(name: "file") File file,); @POST("/chat/info") Future> getChatUserInfo(@Query("user_ids") List userIds,); // ********************** 分享相关 ***************************** @POST("/share/createSport") Future> getshareCreateSport(@Query("period") String period,@Query("weight") double weight); @POST("/share/forwardSport") Future> getshareForwardSport(@Query("h") String hash,@Query("user_id") int userId); // ********************** 公告相关 ***************************** @GET("/inform/list") Future> getInformList({@Query("p") int page}); @POST("/inform/read") Future postInformRead(@Query("informId") int informId); @GET("/notice/list") Future> getNoticeList( {@Query("type") String type, @Query("markread") String markread = "currpage", @Query("p") int page, @Query("read") String read, @Query("isMsg") String isMsg = "1"}); @GET("/notice/count") Future> getNoticeCount(@Query("type") String type, @Query("read") String read, {@Query("isMsg") String isMsg = "1"}); @POST("/notice/read") Future> postNoticeRead(@Query("noticeId") int noticeId); // ********************** 反馈相关 ***************************** @GET("/feedback/types") Future> getFeedbackTypes(); @GET("/feedback/myChats") Future> getFeedbackChat({@Query("groupId") int groupId, @Query("typeId") int typeId}); @POST("/feedback/post") Future> postFeedback(@Query("typeId") int typeId, @Query("content") String content, {@Query("images") String images, @Query("extra") String extra}); @POST("/media/Up4Feedback") @Headers({ "content-type": "multipart/form-data", }) Future> mediaUp4Feedback(@Part(name: "media") File file); @POST("/media/Up4Subject") @Headers({ "content-type": "multipart/form-data", }) Future> mediaUp4Subject(@Part(name: "media") File file, {@Query("srcType") String srcType, @Query("subjectId") String subjectId, CancelToken cancelToken}); // ********************** 游戏相关 ********************************* @GET("/game/all") Future> getGameAll(); @GET("/game/all") Future getGameById(@Query("id") int id); @GET("/rank/all") Future> getRankInfoAll(); @GET("/rank/game") Future> getRankGameInfo(@Query("game_id") String id, {@Query("scope") String scope}); @GET("/rank/sport") Future> getRankSportInfo(@Query("rank_id") String id, {@Query("scope") String scope}); // ********************** 商城相关 ********************************* @GET("/shop/item") Future> getShopIndex(); @GET("/score/record") Future> getScoreIndex(); @POST("/shop/buy") Future> buyItem(@Query("item_id") String id,); }