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

com.notronix.etsy.impl.method.FindAllShopCouponsMethod Maven / Gradle / Ivy

There is a newer version: 3.0.0014
Show newest version
package com.notronix.etsy.impl.method;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.notronix.etsy.impl.model.EtsyCoupon;

import java.util.List;

import static java.util.Objects.requireNonNull;

public class FindAllShopCouponsMethod extends AbstractEtsyMethod>
{
    private String shopIdOrName;

    @Override
    String getURI() {
        return "/shops/" + requireNonNull(shopIdOrName) + "/coupons";
    }

    @Override
    public boolean requiresOAuth() {
        return true;
    }

    @Override
    public List getResponse(Gson gson, String jsonPayload) {
        EtsyResponse> response =
                gson.fromJson(jsonPayload, new TypeToken>>(){}.getType());

        return response.getResults();
    }

    public String getShopIdOrName() {
        return shopIdOrName;
    }

    public void setShopIdOrName(String shopIdOrName) {
        this.shopIdOrName = shopIdOrName;
    }

    public FindAllShopCouponsMethod withShopIdOrName(String shopIdOrName) {
        this.shopIdOrName = shopIdOrName;
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy