Advertisement
Guest User

Untitled

a guest
May 30th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 6.04 KB | None | 0 0
  1. package pl.intenso.carefleet.repository
  2.  
  3. import io.reactivex.Single
  4. import okhttp3.Credentials
  5. import okhttp3.ResponseBody
  6. import pl.intenso.carefleet.BuildConfig
  7. import pl.intenso.carefleet.model.*
  8. import pl.intenso.carefleet.model.api_model.*
  9. import pl.intenso.carefleet.usecase.FirebaseNotificationDto
  10. import retrofit2.Response
  11. import retrofit2.http.*
  12.  
  13. /**
  14.  * Piotr Murtowski on 17.11.2017.
  15.  */
  16. interface RestApiService {
  17.  
  18.     @FormUrlEncoded
  19.     @POST("oauth/token")
  20.     fun login(@Field("username") username: String,
  21.               @Field("password") password: String,
  22.               @Field("grant_type") grantType: String = "password",
  23.               @Header("Authorization") authorizationHeader: String = Credentials.basic(BuildConfig.apiClientId, BuildConfig.apiClientSecret)): Single<Response<LoginResponse>>
  24.  
  25.     @FormUrlEncoded
  26.     @POST("oauth/token")
  27.     fun authorizeApiClient(
  28.             @Field("grant_type") grantType: String = "client_credentials",
  29.             @Header("Authorization") authorizationHeader: String = Credentials.basic(BuildConfig.apiClientId, BuildConfig.apiClientSecret)): Single<Response<LoginResponse>>
  30.  
  31.  
  32.     /**
  33.      * Terms
  34.      */
  35.     @POST("/v1/mobile-app-regulations/current/accept")
  36.     fun acceptTerms(): Single<Response<Void>>
  37.  
  38.     /**
  39.      * Registration
  40.      */
  41.  
  42.     @POST("registration/checkAccountRegistrationAvailability")
  43.     fun verifyCarContract(@Body carNumberRequest: CarNumberRequest,
  44.                           @Header("Authorization") apiClientToken: String): Single<Response<CarNumberResponse>>
  45.  
  46.     @POST("registration/registerNewAccount")
  47.     fun registerUserAccount(@Body formRegistration: FormRegistration,
  48.                             @Header("Authorization") apiClientToken: String): Single<Response<RegistrationResponse>>
  49.  
  50.     @PATCH("userAccount/unregisterUser")
  51.     fun unregisterUser(): Single<Response<Void>>
  52.  
  53.     /**
  54.      * Remind Password
  55.      */
  56.  
  57.     @POST("registration/verifyUserExistence")
  58.     fun verifyUserExistence(@Body carNumberRequest: CarNumberRequest,
  59.                             @Header("Authorization") apiClientToken: String): Single<UserExistenceResponse>
  60.  
  61.     @PATCH("registration/changePassword")
  62.     fun changePassword(@Body remindPassword: FormRemindPassword,
  63.                        @Header("Authorization") apiClientToken: String): Single<SuccessResponse>
  64.  
  65.     /**
  66.      * SMS Token Auth
  67.      */
  68.  
  69.     @POST("registration/generateRegistrationCode")
  70.     fun generateRegistrationId(@Body actionIdRequest: SMSAuthorizationActionIdRequest,
  71.                                @Header("Authorization") apiClientToken: String): Single<SMSAuthorizationActionIdResponse>
  72.  
  73.     @POST("sms-message")
  74.     fun requestSmsToken(@Body smsTokenRequest: SMSTokenRequest, @Header("Authorization") apiClientToken: String): Single<SuccessResponse>
  75.  
  76.     @POST("registration/validateRegistrationCode")
  77.     fun validateSMSToken(@Body smsTokenVerificationRequest: SMSTokenVerificationRequest, @Header("Authorization") apiClientToken: String): Single<SuccessResponse>
  78.  
  79.  
  80.     /**
  81.      * Profile
  82.      */
  83.  
  84.     @GET("userAccount") // Zmiana usuniete /getData
  85.     fun getUserData(): Single<User>
  86.  
  87.     @PATCH("userAccount/changeData")
  88.     fun setUserData(@Body profileRequest: ProfileRequest): Single<SuccessResponse>
  89.  
  90.     @PATCH("userAccount/changePassword")
  91.     fun changePasswordForLogged(@Body changePassword: ChangePassword): Single<SuccessResponse>
  92.  
  93.     /**
  94.      * Maps
  95.      * */
  96.     @GET("fuelCard")
  97.     fun getFuelCard(): Single<List<FuelCard>>
  98.  
  99.     @GET("carRepairShop")
  100.     fun getCarServices(): Single<List<CarService>>
  101.  
  102.     @GET("fuelStation")
  103.     fun getPetrolStations(): Single<List<GasStation>>
  104.  
  105.     /**
  106.      * Service History
  107.      * */
  108.  
  109.     @GET("serviceEventHistory")
  110.     fun getCarServiceHistory(): Single<List<ServiceHistoryEvent>>
  111.  
  112.     @POST("carServiceEventOpinion")
  113.     fun rateServiceHistoryItem(@Body rateService: RateService): Single<Response<Any>>
  114.  
  115.     /**
  116.      * Car Data
  117.      */
  118.     @GET("carFixedAsset") // Zmiana usuniete /getData
  119.     fun getCarAndContractDetails(): Single<CarContract>
  120.  
  121.     @PATCH("carFixedAsset/changeData")
  122.     fun changeMileage(@Body updateMileageRequest: UpdateMileageRequest): Single<SuccessResponse>
  123.  
  124.  
  125.     /**
  126.      * Tire Relocation
  127.      */
  128.  
  129.     @GET("carTyres")
  130.     fun getTireInfo(): Single<TiresInfo>
  131.  
  132.     @POST("carFixedAssetStoredTyres/relocate/{id}")
  133.     fun relocateTireToService(@Path("id") destinationServiceId: Long?): Single<SuccessResponse>
  134.  
  135.     /**
  136.      * Firebase
  137.      */
  138.  
  139.     @POST("firebase/userKey")
  140.     fun sendFirebaseToken(@Body firebaseToken: FirebaseToken): Single<SuccessResponse>
  141.  
  142.     /**
  143.      * Damage
  144.      */
  145.  
  146.     @GET("carFixedAssetInsuranceClaim") // Zmiana usuniete /getData
  147.     fun getDamages(): Single<List<DamageEvent>>
  148.  
  149.     @POST("carFixedAssetInsuranceClaim/createClaim")
  150.     fun sendDamageReport(@Body formDamage: FormDamage): Single<SuccessResponse>
  151.  
  152.     @POST("carInsuranceServiceReactionOpinion")
  153.     fun rateDamageItem(@Body rateService: RateService): Single<Response<Any>>
  154.  
  155.     /**
  156.      * Documents Applications
  157.      * */
  158.  
  159.     @GET("licencing")
  160.     fun getDocumentsApplications(): Single<List<Document>>
  161.  
  162.     @POST("licencing/refuel")
  163.     fun sendTankApplication(@Body formDocTankPermission: FormDocTankPermission): Single<Response<Any>>
  164.  
  165.     @GET("licencing/refuel/pdf/{id}")
  166.     fun getTankApplicationPDF(@Path("id") documentApplicationId: Long): Single<Response<ResponseBody>>
  167.  
  168.     @POST("licencing/travelAbroad")
  169.     fun sendTripAbroadApplication(@Body formDocTripAbroad: FormTripAbroad): Single<Response<Any>>
  170.  
  171.     @GET("licencing/travelAbroad/pdf/{id}")
  172.     fun getTripAbroadApplicationPDF(@Path("id") documentApplicationId: Long): Single<Response<ResponseBody>>
  173.  
  174.     /**
  175.      * Notifications
  176.      * */
  177.  
  178.     @GET("notification")
  179.     fun getNotifications(): Single<Response<List<FirebaseNotificationDto>>>
  180.  
  181.     @POST("notification/read")
  182.     fun setNotificationAsRead(@Body notificationsList: List<NotificationRead>): Single<Response<ResponseBody>>
  183.  
  184.  
  185. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement