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

com.notronix.etsy.impl.AbstractEtsyMethod Maven / Gradle / Ivy

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

import com.google.api.client.http.EmptyContent;
import com.google.api.client.http.HttpContent;
import com.google.api.client.http.HttpMethods;
import com.notronix.etsy.api.Marshaller;
import com.notronix.etsy.api.Method;
import com.notronix.etsy.api.authentication.model.Credentials;

import static java.util.Objects.requireNonNull;

public abstract class AbstractEtsyMethod implements Method
{
    private final Credentials clientCredentials;
    private final Credentials accessCredentials;

    protected abstract String getURI();

    public AbstractEtsyMethod(Credentials clientCredentials) {
        this(clientCredentials, null);
    }

    public AbstractEtsyMethod(Credentials clientCredentials, Credentials accessCredentials) {
        this.clientCredentials = requireNonNull(clientCredentials);
        this.accessCredentials = accessCredentials;
    }

    @Override
    public String getRequestMethod() {
        return HttpMethods.GET;
    }

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

    @Override
    public HttpContent getContent(Marshaller marshaller) {
        return new EmptyContent();
    }

    @Override
    public Credentials getClientCredentials() {
        return clientCredentials;
    }

    @Override
    public Credentials getAccessCredentials() {
        return accessCredentials;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy