com.dft.api.shopify.v202401.SmartCollectionApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shopify-admin-rest Show documentation
Show all versions of shopify-admin-rest Show documentation
Shopify Admin REST API using JDK 11 and Reactive Programming
package com.dft.api.shopify.v202401;
import com.dft.api.shopify.ShopifySdkNew;
import com.dft.api.shopify.model.auth.AccessCredential;
import com.dft.api.shopify.model.collection.custom.CustomCollectionWrapper;
import com.dft.api.shopify.model.collection.smart.SmartCollectionWrapper;
import java.net.URI;
import java.net.http.HttpRequest;
import java.util.HashMap;
import java.util.List;
public class SmartCollectionApi extends ShopifySdkNew {
private static final String SMART_COLLECTIONS = "/smart_collections";
private static final String CUSTOM_COLLECTIONS = "/custom_collections";
public static final String VERSION_2024_01 = "/2024-01";
public static final String VERSION_2024_07 = "/2024-07";
public SmartCollectionApi(AccessCredential accessCredential) {
super(accessCredential);
}
public SmartCollectionWrapper getAllSmartCollections(HashMap params) {
URI uri = baseUrl(VERSION_2024_01, SMART_COLLECTIONS);
uri = addParameters(uri, params);
HttpRequest request = get(uri);
return getRequestWrapped(request, SmartCollectionWrapper.class);
}
public CustomCollectionWrapper getAllCustomCollections(HashMap params) {
URI uri = baseUrl(VERSION_2024_01, CUSTOM_COLLECTIONS);
uri = addParameters(uri, params);
HttpRequest request = get(uri);
return getRequestWrapped(request, CustomCollectionWrapper.class);
}
public CustomCollectionWrapper createCustomCollection(CustomCollectionWrapper customCollectionWrapper) {
URI uri = baseUrl(VERSION_2024_07, CUSTOM_COLLECTIONS);
HttpRequest request = postWithObject(uri, customCollectionWrapper);
return getRequestWrapped(request, CustomCollectionWrapper.class);
}
public CustomCollectionWrapper addProductsToCustomCollection(CustomCollectionWrapper collectionWrapper) {
URI uri = baseUrl(VERSION_2024_07, CUSTOM_COLLECTIONS + "/" + collectionWrapper.getCustomCollection().getId());
HttpRequest request = putWithObject(uri, collectionWrapper);
return getRequestWrapped(request, CustomCollectionWrapper.class);
}
}