ChinaTowerApiService.java 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package com.paul.drone.network;
  2. import com.paul.drone.data.OAuth2TokenResponse;
  3. import com.paul.drone.data.RefreshTokenResponse;
  4. import com.paul.drone.data.RegisterRequest;
  5. import com.paul.drone.data.RegisterDeviceResponse;
  6. import com.paul.drone.data.SmsCodeResponse;
  7. import com.paul.drone.data.UpdateInfoRequest;
  8. import com.paul.drone.data.UpdateInfoResponse;
  9. import retrofit2.Call;
  10. import retrofit2.http.Body;
  11. import retrofit2.http.Field;
  12. import retrofit2.http.FormUrlEncoded;
  13. import retrofit2.http.GET;
  14. import retrofit2.http.Header;
  15. import retrofit2.http.POST;
  16. import retrofit2.http.Query;
  17. /**
  18. * 中国铁塔视联平台API服务接口
  19. */
  20. public interface ChinaTowerApiService {
  21. /**
  22. * 获取 OAuth2 Token(手机号验证码登录)
  23. */
  24. @FormUrlEncoded
  25. @POST("/hntt-auth/auth/oauth2/token")
  26. Call<OAuth2TokenResponse> getOAuth2Token(
  27. @Header("Authorization") String authorization,
  28. @Field("mobile") String username,
  29. @Field("grant_type") String grantType,
  30. @Field("scope") String scope,
  31. @Field("code") String code
  32. );
  33. /**
  34. * 获取 OAuth2 Token(密码登录)
  35. */
  36. @FormUrlEncoded
  37. @POST("/hntt-auth/auth/oauth2/token")
  38. Call<OAuth2TokenResponse> getOAuth2TokenByPassword(
  39. @Header("Authorization") String authorization,
  40. @Field("username") String username,
  41. @Field("password") String password,
  42. @Field("grant_type") String grantType,
  43. @Field("scope") String clientId
  44. );
  45. /**
  46. * 刷新访问令牌
  47. */
  48. @FormUrlEncoded
  49. @POST("/hntt-auth/auth/oauth2/token")
  50. Call<RefreshTokenResponse> refreshToken(
  51. @Header("Authorization") String authorization,
  52. @Field("grant_type") String grantType,
  53. @Field("refresh_token") String refreshToken,
  54. @Field("scope") String clientId
  55. );
  56. /**
  57. * 发送手机验证码
  58. */
  59. @FormUrlEncoded
  60. @POST("/hntt-system/app/code")
  61. Call<SmsCodeResponse> sendSmsCode(@Field("phone") String mobile);
  62. /**
  63. * 设备注册
  64. */
  65. @POST("/hntt-device/uav/device/api/register-device")
  66. Call<RegisterDeviceResponse> registerDevice(
  67. @Header("Authorization") String authorization,
  68. @Body RegisterRequest request
  69. );
  70. /**
  71. * 检查版本更新
  72. */
  73. @POST("/hntt-system/system/upgrade/app")
  74. Call<UpdateInfoResponse> checkUpdate(
  75. @Body UpdateInfoRequest request
  76. );
  77. }