All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scayle.adminapi.service.BrandService Maven / Gradle / Ivy

There is a newer version: 1.24.0
Show newest version
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 BrandService extends AbstractService {
    public BrandService(HttpClient httpClient) {
        super(httpClient);
    }

    
    public ApiCollection all() throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Brand.class;

        return this.requestCollection("get", this.resolvePath("/brands"), null, null, responseModel);
    }

    
    public ApiCollection all(ApiOptions options) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Brand.class;

        Map query = options.all();

        return this.requestCollection("get", this.resolvePath("/brands"), query, null, responseModel);
    }

    
    public Brand get(Integer brandId) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Brand.class;

        return this.request("get", this.resolvePath("/brands/%s", brandId), null, null, responseModel);
    }

    
    public Brand get(Integer brandId, ApiOptions options) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Brand.class;

        Map query = options.all();

        return this.request("get", this.resolvePath("/brands/%s", brandId), query, null, responseModel);
    }

    
    public Brand create(Brand model) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Brand.class;

        return this.request("post", this.resolvePath("/brands"), null, null, responseModel, model);
    }

    
    public Brand create(Brand model, ApiOptions options) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Brand.class;

        Map query = options.all();

        return this.request("post", this.resolvePath("/brands"), query, null, responseModel, model);
    }

    
    public Brand update(Integer brandId, Brand model) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Brand.class;

        return this.request("put", this.resolvePath("/brands/%s", brandId), null, null, responseModel, model);
    }

    
    public Brand update(Integer brandId, Brand model, ApiOptions options) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Brand.class;

        Map query = options.all();

        return this.request("put", this.resolvePath("/brands/%s", brandId), query, null, responseModel, model);
    }

    
    public void delete(Integer brandId) throws ApiErrorException, ConnectionException {

        this.request("delete", this.resolvePath("/brands/%s", brandId), null, null, null);
    }

    
    public void delete(Integer brandId, ApiOptions options) throws ApiErrorException, ConnectionException {

        Map query = options.all();

        this.request("delete", this.resolvePath("/brands/%s", brandId), query, null, null);
    }

    
    public Map createOrUpdateCustomData(Integer brandId, Map model) throws ApiErrorException, ConnectionException {
        Class> responseModel = (Class>)(Class)Map.class;

        return this.request("put", this.resolvePath("/brands/%s/custom-data", brandId), null, null, responseModel, model);
    }

    
    public Map createOrUpdateCustomData(Integer brandId, Map model, ApiOptions options) throws ApiErrorException, ConnectionException {
        Class> responseModel = (Class>)(Class)Map.class;

        Map query = options.all();

        return this.request("put", this.resolvePath("/brands/%s/custom-data", brandId), query, null, responseModel, model);
    }

    
    public void deleteCustomData(Integer brandId) throws ApiErrorException, ConnectionException {

        this.request("delete", this.resolvePath("/brands/%s/custom-data", brandId), null, null, null);
    }

    
    public void deleteCustomData(Integer brandId, ApiOptions options) throws ApiErrorException, ConnectionException {

        Map query = options.all();

        this.request("delete", this.resolvePath("/brands/%s/custom-data", brandId), query, null, null);
    }

    
    public Map getCustomData(Integer brandId) throws ApiErrorException, ConnectionException {
        Class> responseModel = (Class>)(Class)Map.class;

        return this.request("get", this.resolvePath("/brands/%s/custom-data", brandId), null, null, responseModel);
    }

    
    public Map getCustomData(Integer brandId, ApiOptions options) throws ApiErrorException, ConnectionException {
        Class> responseModel = (Class>)(Class)Map.class;

        Map query = options.all();

        return this.request("get", this.resolvePath("/brands/%s/custom-data", brandId), query, null, responseModel);
    }

    
    public Map createOrUpdateCustomDataForKey(Integer brandId, String key, Map model) throws ApiErrorException, ConnectionException {
        Class> responseModel = (Class>)(Class)Map.class;

        return this.request("put", this.resolvePath("/brands/%s/custom-data/%s", brandId, key), null, null, responseModel, model);
    }

    
    public Map createOrUpdateCustomDataForKey(Integer brandId, 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("/brands/%s/custom-data/%s", brandId, key), query, null, responseModel, model);
    }

    
    public void deleteCustomDataForKey(Integer brandId, String key) throws ApiErrorException, ConnectionException {

        this.request("delete", this.resolvePath("/brands/%s/custom-data/%s", brandId, key), null, null, null);
    }

    
    public void deleteCustomDataForKey(Integer brandId, String key, ApiOptions options) throws ApiErrorException, ConnectionException {

        Map query = options.all();

        this.request("delete", this.resolvePath("/brands/%s/custom-data/%s", brandId, key), query, null, null);
    }

    
    public Map getCustomDataForKey(Integer brandId, String key) throws ApiErrorException, ConnectionException {
        Class> responseModel = (Class>)(Class)Map.class;

        return this.request("get", this.resolvePath("/brands/%s/custom-data/%s", brandId, key), null, null, responseModel);
    }

    
    public Map getCustomDataForKey(Integer brandId, String key, ApiOptions options) throws ApiErrorException, ConnectionException {
        Class> responseModel = (Class>)(Class)Map.class;

        Map query = options.all();

        return this.request("get", this.resolvePath("/brands/%s/custom-data/%s", brandId, key), query, null, responseModel);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy