login_api.dart 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import 'dart:io';
  2. import 'package:dio/dio.dart' hide Headers;
  3. import 'package:retrofit/retrofit.dart';
  4. import 'package:sport/bean/achievement_detail_info.dart';
  5. import 'package:sport/bean/achievement_info.dart';
  6. import 'package:sport/bean/achievement_rule.dart';
  7. import 'package:sport/bean/bind_info.dart';
  8. import 'package:sport/bean/feed_back.dart';
  9. import 'package:sport/bean/login.dart';
  10. import 'package:sport/services/api/resp.dart';
  11. part 'login_api.g.dart';
  12. //@RestApi(baseUrl: "https://local.moodrain.cn")
  13. @RestApi()
  14. abstract class LoginApi {
  15. factory LoginApi(Dio dio, {String baseUrl}) = _LoginApi;
  16. @POST("/user/loginByPhone")
  17. Future<LoginInfo> getLoginInfo(@Query("phone") String phone, {@Query("password") String? password, @Query("captcha") String? captcha});
  18. @POST("/user/sendCaptcha")
  19. Future getCaptcha(@Query("phone") String phone);
  20. @POST("/user/loginByQQ")
  21. Future<LoginInfo> loginQQ(@Query("openid") String openid, @Query("name") String name, {@Query("unionid") String? unionid, @Query("avatar") String? avatar, @Query("gender") int? gender});
  22. @POST("/user/loginByWx")
  23. Future<LoginInfo> loginByWx(@Query("code") String code);
  24. @POST("/user/loginByApple")
  25. Future<LoginInfo> loginByApple(@Query("apple_id") String appleId, @Query("identity_token") String identityToken, @Query("name") String name);
  26. @POST("/user/registerByPhone")
  27. Future<LoginInfo> registerByPhone(@Query("phone") String phone, @Query("password") String password, @Query("captcha") String captcha);
  28. @POST("/user/clientConfig")
  29. Future clientConfig(@Query("custom_json") String json);
  30. @POST("/user/updateInfo")
  31. Future<RespData<User>> updateInfo(
  32. @Query("name") String name,
  33. @Query("gender") int gender, {
  34. @Query("age") int? age,
  35. @Query("province_id") int? province_id,
  36. @Query("city_id") int? city_id,
  37. @Query("district_id") int? district_id,
  38. @Query("weight") double? weight,
  39. @Query("ignore_name_card") int? ignore_name_card,
  40. });
  41. @POST("/user/verifyCaptcha")
  42. Future verifyCaptcha(
  43. @Query("phone") String phone,
  44. @Query("captcha") String captcha,
  45. );
  46. @POST("/user/resetPasswordByCaptcha")
  47. Future resetPasswordByCaptcha(
  48. @Query("phone") String? phone,
  49. @Query("captcha") String? captcha,
  50. @Query("password") String? password,
  51. );
  52. @GET("/achievement/info")
  53. Future<AchievementInfo> getAchievementInfo();
  54. @GET('/achievement/show')
  55. Future<AchieveDetailInfo> getAchieveDetailInfo(@Query("id") int id, {@Query("user_id") String? userId});
  56. @GET("/achievement/rule")
  57. Future<RespData<AchievementRule>> getAchievementRule();
  58. @GET('/user/bindInfo')
  59. Future<BindInfo> getBindInfo();
  60. @GET('/user/bindPhone')
  61. Future bindPhone(@Query("phone") String phone, @Query("captcha") String captcha);
  62. @GET('/user/bindWx')
  63. Future bindWx(@Query("code") String code);
  64. @GET("/user/bindQQ")
  65. Future bindQQ(@Query("openid") String openid, {@Query("unionid") String? unionid});
  66. @POST("/user/resetPasswordByOld")
  67. Future resetPasswordByOld(@Query("old_password") String? old_password, @Query("new_password") String? new_password);
  68. @GET("/feedback/types")
  69. Future<FeedTypeInfo> getFeedBackTypes();
  70. @POST("/feedback/myChats")
  71. Future<FeedBackInfo> getFeedBackChats({
  72. @Query("typeId") int? typeId,
  73. @Query("groupId") int? groupId,
  74. @Query("limit") int? limit,
  75. });
  76. @POST("/feedback/post")
  77. Future postFeedBack(@Query("typeId") int typeId, @Query("content") String content, {@Query("images") String? images});
  78. @POST("/user/setAvatar")
  79. @Headers(<String, dynamic>{
  80. "content-type": "multipart/form-data",
  81. })
  82. Future<RespData<String>> setAvatar(@Part(name: "file") File file);
  83. @POST("/user/DeleteSelf")
  84. Future deleteUser();
  85. }