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.ProductService 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 ProductService extends AbstractService {
public ProductService(HttpClient httpClient) {
super(httpClient);
}
public Product create(Product model) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Product.class;
return this.request("post", this.resolvePath("/products"), null, null, responseModel, model);
}
public Product create(Product model, ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Product.class;
Map query = options.all();
return this.request("post", this.resolvePath("/products"), query, null, responseModel, model);
}
public Product get(Identifier productIdentifier) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Product.class;
return this.request("get", this.resolvePath("/products/%s", productIdentifier), null, null, responseModel);
}
public Product get(Identifier productIdentifier, ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Product.class;
Map query = options.all();
return this.request("get", this.resolvePath("/products/%s", productIdentifier), query, null, responseModel);
}
public ApiCollection all() throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Product.class;
return this.requestCollection("get", this.resolvePath("/products"), null, null, responseModel);
}
public ApiCollection all(ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Product.class;
Map query = options.all();
return this.requestCollection("get", this.resolvePath("/products"), query, null, responseModel);
}
public Product update(Identifier productIdentifier, Product model) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Product.class;
return this.request("put", this.resolvePath("/products/%s", productIdentifier), null, null, responseModel, model);
}
public Product update(Identifier productIdentifier, Product model, ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Product.class;
Map query = options.all();
return this.request("put", this.resolvePath("/products/%s", productIdentifier), query, null, responseModel, model);
}
public void delete(Identifier productIdentifier) throws ApiErrorException, ConnectionException {
this.request("delete", this.resolvePath("/products/%s", productIdentifier), null, null, null);
}
public void delete(Identifier productIdentifier, ApiOptions options) throws ApiErrorException, ConnectionException {
Map query = options.all();
this.request("delete", this.resolvePath("/products/%s", productIdentifier), query, null, null);
}
public Attribute updateOrCreateAttribute(Identifier productIdentifier, Attribute model) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Attribute.class;
return this.request("post", this.resolvePath("/products/%s/attributes", productIdentifier), null, null, responseModel, model);
}
public Attribute updateOrCreateAttribute(Identifier productIdentifier, Attribute model, ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Attribute.class;
Map query = options.all();
return this.request("post", this.resolvePath("/products/%s/attributes", productIdentifier), query, null, responseModel, model);
}
public void deleteAttribute(Identifier productIdentifier, String attributeGroupName) throws ApiErrorException, ConnectionException {
this.request("delete", this.resolvePath("/products/%s/attributes/%s", productIdentifier, attributeGroupName), null, null, null);
}
public void deleteAttribute(Identifier productIdentifier, String attributeGroupName, ApiOptions options) throws ApiErrorException, ConnectionException {
Map query = options.all();
this.request("delete", this.resolvePath("/products/%s/attributes/%s", productIdentifier, attributeGroupName), query, null, null);
}
public Attribute getAttribute(Identifier productIdentifier, String attributeGroupName) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Attribute.class;
return this.request("get", this.resolvePath("/products/%s/attributes/%s", productIdentifier, attributeGroupName), null, null, responseModel);
}
public Attribute getAttribute(Identifier productIdentifier, String attributeGroupName, ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Attribute.class;
Map query = options.all();
return this.request("get", this.resolvePath("/products/%s/attributes/%s", productIdentifier, attributeGroupName), query, null, responseModel);
}
public ApiCollection allAttributes(Identifier productIdentifier) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Attribute.class;
return this.requestCollection("get", this.resolvePath("/products/%s/attributes", productIdentifier), null, null, responseModel);
}
public ApiCollection allAttributes(Identifier productIdentifier, ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Attribute.class;
Map query = options.all();
return this.requestCollection("get", this.resolvePath("/products/%s/attributes", productIdentifier), query, null, responseModel);
}
public ProductMasterCategories updateMasterCategories(Identifier productIdentifier, ProductMasterCategories model) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)ProductMasterCategories.class;
return this.request("put", this.resolvePath("/products/%s/master-categories", productIdentifier), null, null, responseModel, model);
}
public ProductMasterCategories updateMasterCategories(Identifier productIdentifier, ProductMasterCategories model, ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)ProductMasterCategories.class;
Map query = options.all();
return this.request("put", this.resolvePath("/products/%s/master-categories", productIdentifier), query, null, responseModel, model);
}
public Map createOrUpdateCustomData(Identifier productIdentifier, Map model) throws ApiErrorException, ConnectionException {
Class> responseModel = (Class>)(Class>)Map.class;
return this.request("put", this.resolvePath("/products/%s/custom-data", productIdentifier), null, null, responseModel, model);
}
public Map createOrUpdateCustomData(Identifier productIdentifier, Map model, ApiOptions options) throws ApiErrorException, ConnectionException {
Class> responseModel = (Class>)(Class>)Map.class;
Map query = options.all();
return this.request("put", this.resolvePath("/products/%s/custom-data", productIdentifier), query, null, responseModel, model);
}
public void deleteCustomData(Identifier productIdentifier) throws ApiErrorException, ConnectionException {
this.request("delete", this.resolvePath("/products/%s/custom-data", productIdentifier), null, null, null);
}
public void deleteCustomData(Identifier productIdentifier, ApiOptions options) throws ApiErrorException, ConnectionException {
Map query = options.all();
this.request("delete", this.resolvePath("/products/%s/custom-data", productIdentifier), query, null, null);
}
public Map getCustomData(Identifier productIdentifier) throws ApiErrorException, ConnectionException {
Class> responseModel = (Class>)(Class>)Map.class;
return this.request("get", this.resolvePath("/products/%s/custom-data", productIdentifier), null, null, responseModel);
}
public Map getCustomData(Identifier productIdentifier, ApiOptions options) throws ApiErrorException, ConnectionException {
Class> responseModel = (Class>)(Class>)Map.class;
Map query = options.all();
return this.request("get", this.resolvePath("/products/%s/custom-data", productIdentifier), query, null, responseModel);
}
public Map createOrUpdateCustomDataForKey(Identifier productIdentifier, String key, Map model) throws ApiErrorException, ConnectionException {
Class> responseModel = (Class>)(Class>)Map.class;
return this.request("put", this.resolvePath("/products/%s/custom-data/%s", productIdentifier, key), null, null, responseModel, model);
}
public Map createOrUpdateCustomDataForKey(Identifier productIdentifier, String key, Map model, ApiOptions options) throws ApiErrorException, ConnectionException {
Class> responseModel = (Class>)(Class>)Map.class;
Map query = options.all();
return this.request("put", this.resolvePath("/products/%s/custom-data/%s", productIdentifier, key), query, null, responseModel, model);
}
public void deleteCustomDataForKey(Identifier productIdentifier, String key) throws ApiErrorException, ConnectionException {
this.request("delete", this.resolvePath("/products/%s/custom-data/%s", productIdentifier, key), null, null, null);
}
public void deleteCustomDataForKey(Identifier productIdentifier, String key, ApiOptions options) throws ApiErrorException, ConnectionException {
Map query = options.all();
this.request("delete", this.resolvePath("/products/%s/custom-data/%s", productIdentifier, key), query, null, null);
}
public Map getCustomDataForKey(Identifier productIdentifier, String key) throws ApiErrorException, ConnectionException {
Class> responseModel = (Class>)(Class>)Map.class;
return this.request("get", this.resolvePath("/products/%s/custom-data/%s", productIdentifier, key), null, null, responseModel);
}
public Map getCustomDataForKey(Identifier productIdentifier, String key, ApiOptions options) throws ApiErrorException, ConnectionException {
Class> responseModel = (Class>)(Class>)Map.class;
Map query = options.all();
return this.request("get", this.resolvePath("/products/%s/custom-data/%s", productIdentifier, key), query, null, responseModel);
}
public Product createComposite(Product model) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Product.class;
return this.request("post", this.resolvePath("/products/composite"), null, null, responseModel, model);
}
public Product createComposite(Product model, ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Product.class;
Map query = options.all();
return this.request("post", this.resolvePath("/products/composite"), query, null, responseModel, model);
}
public Product updateComposite(Identifier productIdentifier, Product model) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Product.class;
return this.request("put", this.resolvePath("/products/composite/%s", productIdentifier), null, null, responseModel, model);
}
public Product updateComposite(Identifier productIdentifier, Product model, ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)Product.class;
Map query = options.all();
return this.request("put", this.resolvePath("/products/composite/%s", productIdentifier), query, null, responseModel, model);
}
public void deleteComposite(Identifier productIdentifier) throws ApiErrorException, ConnectionException {
this.request("delete", this.resolvePath("/products/composite/%s", productIdentifier), null, null, null);
}
public void deleteComposite(Identifier productIdentifier, ApiOptions options) throws ApiErrorException, ConnectionException {
Map query = options.all();
this.request("delete", this.resolvePath("/products/composite/%s", productIdentifier), query, null, null);
}
public ProductState updateState(Identifier productIdentifier, ProductState model) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)ProductState.class;
return this.request("put", this.resolvePath("/products/%s/state", productIdentifier), null, null, responseModel, model);
}
public ProductState updateState(Identifier productIdentifier, ProductState model, ApiOptions options) throws ApiErrorException, ConnectionException {
Class responseModel = (Class)(Class>)ProductState.class;
Map query = options.all();
return this.request("put", this.resolvePath("/products/%s/state", productIdentifier), query, null, responseModel, model);
}
}