Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.scayle.adminapi.service.PromotionService Maven / Gradle / Ivy
package com.scayle.adminapi.service;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import com.scayle.adminapi.exception.ApiErrorException;
import com.scayle.adminapi.exception.ConnectionException;
import com.scayle.adminapi.http.HttpClient;
import com.scayle.adminapi.model.*;
@SuppressWarnings("unchecked")
public class PromotionService extends AbstractService {
public PromotionService(HttpClient httpClient) {
super(httpClient);
}
public ApiCollection all() throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Promotion.class;
return this.requestCollection("get", this.resolvePath("/promotions"), null, null, responseModel);
}
public ApiCollection all(ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Promotion.class;
Map query = options.all();
return this.requestCollection("get", this.resolvePath("/promotions"), query, null, responseModel);
}
public Promotion create(Promotion model) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Promotion.class;
return this.request("post", this.resolvePath("/promotions"), null, null, responseModel, model);
}
public Promotion create(Promotion model, ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Promotion.class;
Map query = options.all();
return this.request("post", this.resolvePath("/promotions"), query, null, responseModel, model);
}
public Promotion get(String promotionId) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Promotion.class;
return this.request("get", this.resolvePath("/promotions/%s", promotionId), null, null, responseModel);
}
public Promotion get(String promotionId, ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Promotion.class;
Map query = options.all();
return this.request("get", this.resolvePath("/promotions/%s", promotionId), query, null, responseModel);
}
public void delete(String promotionId) throws ApiErrorException, ConnectionException {
this.request("delete", this.resolvePath("/promotions/%s", promotionId), null, null, null);
}
public void delete(String promotionId, ApiOptions options) throws ApiErrorException, ConnectionException {
Map query = options.all();
this.request("delete", this.resolvePath("/promotions/%s", promotionId), query, null, null);
}
public Promotion update(String promotionId, Promotion model) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Promotion.class;
return this.request("put", this.resolvePath("/promotions/%s", promotionId), null, null, responseModel, model);
}
public Promotion update(String promotionId, Promotion model, ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Promotion.class;
Map query = options.all();
return this.request("put", this.resolvePath("/promotions/%s", promotionId), query, null, responseModel, model);
}
}