Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.intenso.carefleet.repository
- import io.reactivex.Single
- import okhttp3.Credentials
- import okhttp3.ResponseBody
- import pl.intenso.carefleet.BuildConfig
- import pl.intenso.carefleet.model.*
- import pl.intenso.carefleet.model.api_model.*
- import pl.intenso.carefleet.usecase.FirebaseNotificationDto
- import retrofit2.Response
- import retrofit2.http.*
- /**
- * Piotr Murtowski on 17.11.2017.
- */
- interface RestApiService {
- @FormUrlEncoded
- @POST("oauth/token")
- fun login(@Field("username") username: String,
- @Field("password") password: String,
- @Field("grant_type") grantType: String = "password",
- @Header("Authorization") authorizationHeader: String = Credentials.basic(BuildConfig.apiClientId, BuildConfig.apiClientSecret)): Single<Response<LoginResponse>>
- @FormUrlEncoded
- @POST("oauth/token")
- fun authorizeApiClient(
- @Field("grant_type") grantType: String = "client_credentials",
- @Header("Authorization") authorizationHeader: String = Credentials.basic(BuildConfig.apiClientId, BuildConfig.apiClientSecret)): Single<Response<LoginResponse>>
- /**
- * Terms
- */
- @POST("/v1/mobile-app-regulations/current/accept")
- fun acceptTerms(): Single<Response<Void>>
- /**
- * Registration
- */
- @POST("registration/checkAccountRegistrationAvailability")
- fun verifyCarContract(@Body carNumberRequest: CarNumberRequest,
- @Header("Authorization") apiClientToken: String): Single<Response<CarNumberResponse>>
- @POST("registration/registerNewAccount")
- fun registerUserAccount(@Body formRegistration: FormRegistration,
- @Header("Authorization") apiClientToken: String): Single<Response<RegistrationResponse>>
- @PATCH("userAccount/unregisterUser")
- fun unregisterUser(): Single<Response<Void>>
- /**
- * Remind Password
- */
- @POST("registration/verifyUserExistence")
- fun verifyUserExistence(@Body carNumberRequest: CarNumberRequest,
- @Header("Authorization") apiClientToken: String): Single<UserExistenceResponse>
- @PATCH("registration/changePassword")
- fun changePassword(@Body remindPassword: FormRemindPassword,
- @Header("Authorization") apiClientToken: String): Single<SuccessResponse>
- /**
- * SMS Token Auth
- */
- @POST("registration/generateRegistrationCode")
- fun generateRegistrationId(@Body actionIdRequest: SMSAuthorizationActionIdRequest,
- @Header("Authorization") apiClientToken: String): Single<SMSAuthorizationActionIdResponse>
- @POST("sms-message")
- fun requestSmsToken(@Body smsTokenRequest: SMSTokenRequest, @Header("Authorization") apiClientToken: String): Single<SuccessResponse>
- @POST("registration/validateRegistrationCode")
- fun validateSMSToken(@Body smsTokenVerificationRequest: SMSTokenVerificationRequest, @Header("Authorization") apiClientToken: String): Single<SuccessResponse>
- /**
- * Profile
- */
- @GET("userAccount") // Zmiana usuniete /getData
- fun getUserData(): Single<User>
- @PATCH("userAccount/changeData")
- fun setUserData(@Body profileRequest: ProfileRequest): Single<SuccessResponse>
- @PATCH("userAccount/changePassword")
- fun changePasswordForLogged(@Body changePassword: ChangePassword): Single<SuccessResponse>
- /**
- * Maps
- * */
- @GET("fuelCard")
- fun getFuelCard(): Single<List<FuelCard>>
- @GET("carRepairShop")
- fun getCarServices(): Single<List<CarService>>
- @GET("fuelStation")
- fun getPetrolStations(): Single<List<GasStation>>
- /**
- * Service History
- * */
- @GET("serviceEventHistory")
- fun getCarServiceHistory(): Single<List<ServiceHistoryEvent>>
- @POST("carServiceEventOpinion")
- fun rateServiceHistoryItem(@Body rateService: RateService): Single<Response<Any>>
- /**
- * Car Data
- */
- @GET("carFixedAsset") // Zmiana usuniete /getData
- fun getCarAndContractDetails(): Single<CarContract>
- @PATCH("carFixedAsset/changeData")
- fun changeMileage(@Body updateMileageRequest: UpdateMileageRequest): Single<SuccessResponse>
- /**
- * Tire Relocation
- */
- @GET("carTyres")
- fun getTireInfo(): Single<TiresInfo>
- @POST("carFixedAssetStoredTyres/relocate/{id}")
- fun relocateTireToService(@Path("id") destinationServiceId: Long?): Single<SuccessResponse>
- /**
- * Firebase
- */
- @POST("firebase/userKey")
- fun sendFirebaseToken(@Body firebaseToken: FirebaseToken): Single<SuccessResponse>
- /**
- * Damage
- */
- @GET("carFixedAssetInsuranceClaim") // Zmiana usuniete /getData
- fun getDamages(): Single<List<DamageEvent>>
- @POST("carFixedAssetInsuranceClaim/createClaim")
- fun sendDamageReport(@Body formDamage: FormDamage): Single<SuccessResponse>
- @POST("carInsuranceServiceReactionOpinion")
- fun rateDamageItem(@Body rateService: RateService): Single<Response<Any>>
- /**
- * Documents Applications
- * */
- @GET("licencing")
- fun getDocumentsApplications(): Single<List<Document>>
- @POST("licencing/refuel")
- fun sendTankApplication(@Body formDocTankPermission: FormDocTankPermission): Single<Response<Any>>
- @GET("licencing/refuel/pdf/{id}")
- fun getTankApplicationPDF(@Path("id") documentApplicationId: Long): Single<Response<ResponseBody>>
- @POST("licencing/travelAbroad")
- fun sendTripAbroadApplication(@Body formDocTripAbroad: FormTripAbroad): Single<Response<Any>>
- @GET("licencing/travelAbroad/pdf/{id}")
- fun getTripAbroadApplicationPDF(@Path("id") documentApplicationId: Long): Single<Response<ResponseBody>>
- /**
- * Notifications
- * */
- @GET("notification")
- fun getNotifications(): Single<Response<List<FirebaseNotificationDto>>>
- @POST("notification/read")
- fun setNotificationAsRead(@Body notificationsList: List<NotificationRead>): Single<Response<ResponseBody>>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement