Files
Pizzalemon/app/src/main/java/ch/pizzalink/android/api/ApiInterface.java
2017-10-25 22:27:03 +03:00

133 lines
5.3 KiB
Java

package ch.pizzalink.android.api;
import java.util.HashMap;
import ch.pizzalink.android.model.AddProductToBasketResponseModel;
import ch.pizzalink.android.model.AddressModel;
import ch.pizzalink.android.model.AppVersionModel;
import ch.pizzalink.android.model.CountryModel;
import ch.pizzalink.android.model.DeleteAddressResponseModel;
import ch.pizzalink.android.model.PaymentMethodModel;
import ch.pizzalink.android.model.PaymentMethodsResponseModel;
import ch.pizzalink.android.model.ShippingMethodModel;
import ch.pizzalink.android.model.ShippingMethodsResponseModel;
import ch.pizzalink.android.model.ZoneModel;
import ch.pizzalink.android.model.cart.CartInfoModel;
import ch.pizzalink.android.model.CategoryModel;
import ch.pizzalink.android.model.OrderModel;
import ch.pizzalink.android.model.UserModel;
import ch.pizzalink.android.model.menu.MenuProductModel;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.Url;
/**
* Created by cimenmus on 04/02/2017.
*/
public interface ApiInterface {
@GET(ApiEndPoints.API_GET_ALL_CATEGORIES)
Call<ResponseArray<CategoryModel>> getAllCategories();
/*
@FormUrlEncoded
@POST(ApiEndPoints.API_REGISTER)
Call<ResponseObject<UserModel>> register(@Field("firstname") String firstname,
@Field("lastname") String lastname,
@Field("telephone") String telephone,
@Field("email") String email,
@Field("password") String passsword,
@Field("password1") String passswordRetype,
@Field("address_1") String addressLine1,
@Field("address_2") String addressLine2,
@Field("city") String passswocityrd,
@Field("postcode") String postcode,
@Field("country_id") String country_id,
@Field("zone_id") String zone_id);
*/
@FormUrlEncoded
@POST(ApiEndPoints.API_REGISTER)
Call<ResponseObject<UserModel>> register(@FieldMap HashMap<String, Object> body);
@FormUrlEncoded
@POST(ApiEndPoints.API_LOGIN)
Call<ResponseObject<UserModel>> login(@Field("email") String email, @Field("password") String password);
@FormUrlEncoded
@POST(ApiEndPoints.API_LOGOUT)
Call<ResponseObject> logout(@Field("token") String customerToken);
@GET(ApiEndPoints.API_GET_ORDER_HISTORY)
Call<ResponseArray<OrderModel>> getOrderHistory(@Query("token") String token);
@GET(ApiEndPoints.API_GET_CART_PRODUCTS)
Call<ResponseObject<CartInfoModel>> getCartProducts(@Query("token") String token);
@GET(ApiEndPoints.API_GET_CLEAR_CART)
Call<ResponseObject> clearCart(@Query("token") String token);
@GET(ApiEndPoints.API_GET_PRODUCTS_BY_CATEGORY)
Call<ResponseArray<MenuProductModel>> getProductsByCategory(@Query("category_id") String categoryId);
@FormUrlEncoded
@POST(ApiEndPoints.API_GET_PRODUCT)
Call<ResponseArray<MenuProductModel>> getProductById(@Field("product_id") int productId);
@FormUrlEncoded
@POST
Call<ResponseObject<AddProductToBasketResponseModel>> addProductsToBasket(@Url String url,
@FieldMap HashMap<String, Object> body);
@GET(ApiEndPoints.API_GET_SHIPPING_METHODS)
Call<ResponseArray<ShippingMethodModel>> getShippingMethods(@Query("token") String token);
@GET(ApiEndPoints.API_GET_CUSTOMER_ADDRESSES)
Call<ResponseArray<AddressModel>> getCustomerAddresses(@Query("token") String token);
@GET(ApiEndPoints.API_GET_PAYMENT_METHODS)
Call<ResponseObject<PaymentMethodsResponseModel>> getPaymentMethods(@Query("token") String token);
@FormUrlEncoded
@POST
Call<ResponseObject<Integer>> createOrder(@Url String url, @FieldMap HashMap<String, Object> body);
@FormUrlEncoded
@POST(ApiEndPoints.API_CHECK_UPDATE)
Call<ResponseObject<AppVersionModel>> checkUpdate(@FieldMap HashMap<String, Object> body);
@FormUrlEncoded
@POST(ApiEndPoints.API_FORGOT_PASSWORD)
Call<ResponseObject> forgotPassword(@Field("email") String emailAddress);
@GET(ApiEndPoints.API_GET_ZONE_LIST)
Call<ResponseArray<ZoneModel>> getZoneList();
@GET(ApiEndPoints.API_GET_COUNTRY_LIST)
Call<ResponseArray<CountryModel>> getCountryList();
@GET(ApiEndPoints.API_GET_CUSTOMER_PROFILE)
Call<ResponseObject<UserModel>> getCustomerProfile(@Query("token") String token);
@FormUrlEncoded
@POST
Call<ResponseObject> updatePassword(@Url String url, @FieldMap HashMap<String, Object> body);
@FormUrlEncoded
@POST
Call<ResponseObject<DeleteAddressResponseModel>> deleteAddress(@Url String url,
@Field("address_id") String addressId);
@FormUrlEncoded
@POST
Call<ResponseObject<UserModel>> updateProfile(@Url String url, @FieldMap HashMap<String, Object> body);
}