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_add_entity.dart'; import 'package:sport/bean/game_record.dart'; import 'package:sport/bean/game_record_sum.dart'; import 'package:sport/bean/game_record_history.dart'; import 'package:sport/bean/hardware.dart'; import 'package:sport/bean/image.dart'; import 'package:sport/bean/jog/detail.dart'; import 'package:sport/bean/jog/record.dart'; import 'package:sport/bean/jog/sum.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/exer_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'; import 'package:sport/bean/friend_list.dart'; import 'package:sport/bean/friend_relation.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("/app/hardwareLastVer") Future> checkHardwareUpdate(@Query("hardware_ver") String ver, @Query("app_ver") String appVer); @POST("/app/onConnBt") Future> onConnBt(@Query("shoes_mac") String shoes_mac, @Query("firmware_ver") String firmware_ver, @Query("hardware_ver") String hardware_ver, @Query("app_ver") String app_ver, @Query("os_name") String os_name, @Query("os_ver") String os_ver, @Query("lang") String lang, @Query("phone_brand") String phone_brand, @Query("phone_model") String phone_model); @POST("/app/logHardwareErr") Future> logHardwareErr(@Query("shoes_mac") String shoes_mac, @Query("firmware_ver") String firmware_ver, @Query("hardware_ver") String hardware_ver, @Query("app_ver") String app_ver, @Query("err_code") String err_code, @Query("err_msg") String err_msg, @Query("err_detail") String err_detail); @GET("/user/info") Future> getUserInfo(@Query("id") String uid, {@DioOptions() Options? options}); @GET("/user/info") Future> getUserInfoSelf(); @GET("/user/countNameCard") Future> getCountNameCard(); // ********************** 运动首页相关 ***************************** @GET("/sport/index") Future> getSportIndex(); @GET("/exer/index") Future> getExerIndex(); @GET("/sport/detail") Future> getSportDetail(); @POST("/gameRecord/addGame") Future> postAddGame( @Query("game_id") String gameId, @Query("score") double score, @Query("level") int level, @Query("record") int record, @Query("mode") int mode, @Query("duration") int duration, @Query("consume") int consume, @Query("screen") int screen, @Query("jump") int jumpCount, @Query("crouch") int crouchCount, @Query("step") int stepCount, @Query("distance") int distance, @Query("opponent_id") int opponent_id, @Query("is_cancel") int is_cancel, @Query("play_group") String play_group, @Query("movements") String movements, @Query("time") String time, ); @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("/exerRecord/listOneDay") Future> getSportRecordListOneDay(@Query("date") String date, {@Query("except_daily") int? exceptDaily}); @GET("/exerRecord/listByDay") Future> getSportRecordListByDay(@Query("begin") String begin, @Query("end") String end, {@Query("except_daily") int? exceptDaily}); @GET("/exerRecord/listByMonth") Future> getSportRecordListByMonth(@Query("year") int year, {@Query("except_daily") int? exceptDaily}); @GET("/exerRecord/listByYear") Future> getSportRecordListByYear({@Query("except_daily") int? exceptDaily}); @GET("/exerRecord/history") Future> getSportRecordHistory(@Query("year") int year); @GET("/gameRecord/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, @Query("scope") String? scope}); // ********************** 社区相关 ***************************** @GET("/forum/index") Future> getForumIndex(); @GET("/forum/index2") Future> getForumIndex2(); @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}); @POST("/forum/UserRelation") Future> userRelation({@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") String 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, ); @FormUrlEncoded() @POST("/chat/info") Future> getChatUserInfo( @Field("user_ids") String 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") String 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, ); // ********************** 跑步相关 ********************************* @POST("/jog/addRecord") @Headers({ "content-type": "multipart/form-data", }) Future>> jogAddRecord( @Part(name:"begin") int begin, @Part(name:"end") int end, @Part(name:"distance") int distance, @Part(name:"step") int step, @Part(name:"consume") int consume, @Part(name:"track") String track, @Part(name:"step_info") String stepInfo, @Part(name:"altitude_info") String altitudeInfo, @Part(name:"km_duration_info") String kmDurationInfo, @Part(name:"track_thumb") String thumb, @Part(name: "media") File media, ); @POST("/jog/delRecord") Future> jogDelRecord(@Query("id") int id); @POST("/jog/copyRecord") Future> jogCopyRecord(@Query("id") int id); @GET("/jog/show") Future> jogShowRecord(@Query("id") int id); @GET("/jog/listOneYear") Future> jogListOneYear(@Query("year") int year); @GET("/jog/listByDay") Future> jogListByDay(@Query("begin") String begin, @Query("end") String end); @GET("/jog/listByMonth") Future> jogListByMonth(@Query("year") int year); @GET("/jog/listByYear") Future> jogListByYear(); @FormUrlEncoded() @POST("/jog/setting") Future>> jogSetting({@Field("setting") String? setting}); }