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

com.scayle.adminapi.service.MasterService 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 MasterService extends AbstractService {
    public MasterService(HttpClient httpClient) {
        super(httpClient);
    }

    
    public ProductMasterCategories updateProductMasterMasterCategories(Identifier productMasterIdentifier, ProductMasterCategories model) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)ProductMasterCategories.class;

        return this.request("put", this.resolvePath("/product-masters/%s/master-categories", productMasterIdentifier), null, null, responseModel, model);
    }

    
    public ProductMasterCategories updateProductMasterMasterCategories(Identifier productMasterIdentifier, ProductMasterCategories model, ApiOptions options) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)ProductMasterCategories.class;

        Map query = options.all();

        return this.request("put", this.resolvePath("/product-masters/%s/master-categories", productMasterIdentifier), query, null, responseModel, model);
    }

    
    public ApiCollection allAttributes(Identifier productMasterIdentifier) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Attribute.class;

        return this.requestCollection("get", this.resolvePath("/product-masters/%s/attributes", productMasterIdentifier), null, null, responseModel);
    }

    
    public ApiCollection allAttributes(Identifier productMasterIdentifier, ApiOptions options) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Attribute.class;

        Map query = options.all();

        return this.requestCollection("get", this.resolvePath("/product-masters/%s/attributes", productMasterIdentifier), query, null, responseModel);
    }

    
    public Attribute updateOrCreateAttribute(Identifier productMasterIdentifier, Attribute model) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Attribute.class;

        return this.request("post", this.resolvePath("/product-masters/%s/attributes", productMasterIdentifier), null, null, responseModel, model);
    }

    
    public Attribute updateOrCreateAttribute(Identifier productMasterIdentifier, Attribute model, ApiOptions options) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Attribute.class;

        Map query = options.all();

        return this.request("post", this.resolvePath("/product-masters/%s/attributes", productMasterIdentifier), query, null, responseModel, model);
    }

    
    public Attribute getAttribute(Identifier productMasterIdentifier, String attributeGroupName) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Attribute.class;

        return this.request("get", this.resolvePath("/product-masters/%s/attributes/%s", productMasterIdentifier, attributeGroupName), null, null, responseModel);
    }

    
    public Attribute getAttribute(Identifier productMasterIdentifier, String attributeGroupName, ApiOptions options) throws ApiErrorException, ConnectionException {
        Class responseModel = (Class)(Class)Attribute.class;

        Map query = options.all();

        return this.request("get", this.resolvePath("/product-masters/%s/attributes/%s", productMasterIdentifier, attributeGroupName), query, null, responseModel);
    }

    
    public void deleteAttribute(Identifier productMasterIdentifier, String attributeGroupName) throws ApiErrorException, ConnectionException {

        this.request("delete", this.resolvePath("/product-masters/%s/attributes/%s", productMasterIdentifier, attributeGroupName), null, null, null);
    }

    
    public void deleteAttribute(Identifier productMasterIdentifier, String attributeGroupName, ApiOptions options) throws ApiErrorException, ConnectionException {

        Map query = options.all();

        this.request("delete", this.resolvePath("/product-masters/%s/attributes/%s", productMasterIdentifier, attributeGroupName), query, null, null);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy