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

com.stripe.net.ApiService Maven / Gradle / Ivy

There is a newer version: 28.1.0-beta.3
Show newest version
package com.stripe.net;

import com.stripe.exception.StripeException;
import com.stripe.model.StripeObjectInterface;
import java.io.InputStream;
import java.lang.reflect.Type;
import lombok.AccessLevel;
import lombok.Getter;

/** The base class for all services. */
public abstract class ApiService {
  @Getter(AccessLevel.PROTECTED)
  private final StripeResponseGetter responseGetter;

  protected ApiService(StripeResponseGetter responseGetter) {
    this.responseGetter = responseGetter;
  }

  @SuppressWarnings("TypeParameterUnusedInFormals")
  protected  T request(ApiRequest request, Type typeToken)
      throws StripeException {
    return this.getResponseGetter().request(request.addUsage("stripe_client"), typeToken);
  }

  protected InputStream requestStream(ApiRequest request) throws StripeException {
    return this.getResponseGetter().requestStream(request.addUsage("stripe_client"));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy