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

com.dft.bigcommerce.BigcommerceProductMetaField Maven / Gradle / Ivy

package com.dft.bigcommerce;

import com.dft.bigcommerce.handler.JsonBodyHandler;
import com.dft.bigcommerce.model.credentials.BigcommerceCredentials;
import com.dft.bigcommerce.model.product.productmeta.ProductMetaWrapper;
import lombok.SneakyThrows;
import java.net.URI;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class BigcommerceProductMetaField extends BigcommerceSDK {

    public BigcommerceProductMetaField(BigcommerceCredentials credentials) {
        super(credentials);
    }

    @SneakyThrows
    public ProductMetaWrapper getProductMetaFieldsByProductId(Integer productId) {
        URI uri = baseUrl("/catalog/products/" + productId + "/metafields");
        HttpRequest request = get(uri);
        HttpResponse.BodyHandler handler = new JsonBodyHandler<>(ProductMetaWrapper.class);
        return getRequestWrapped(request, handler);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy