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

com.stripe.net.StripeResponseGetter 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 java.util.Map;

public interface StripeResponseGetter {
  /** @deprecated Use {@link #request(ApiRequest, Type)} instead. */
  @SuppressWarnings("TypeParameterUnusedInFormals")
  @Deprecated
   T request(
      BaseAddress baseAddress,
      ApiResource.RequestMethod method,
      String path,
      Map params,
      Type typeToken,
      RequestOptions options,
      ApiMode apiMode)
      throws StripeException;

  @SuppressWarnings("TypeParameterUnusedInFormals")
  default  T request(ApiRequest request, Type typeToken)
      throws StripeException {
    return request(
        request.getBaseAddress(),
        request.getMethod(),
        request.getPath(),
        request.getParams(),
        typeToken,
        request.getOptions(),
        request.getApiMode());
  };

  /** @deprecated Use {@link #requestStream(ApiRequest)} instead. */
  @SuppressWarnings("TypeParameterUnusedInFormals")
  @Deprecated
  InputStream requestStream(
      BaseAddress baseAddress,
      ApiResource.RequestMethod method,
      String path,
      Map params,
      RequestOptions options,
      ApiMode apiMode)
      throws StripeException;

  default InputStream requestStream(ApiRequest request) throws StripeException {
    return requestStream(
        request.getBaseAddress(),
        request.getMethod(),
        request.getPath(),
        request.getParams(),
        request.getOptions(),
        request.getApiMode());
  };

  default StripeResponse rawRequest(RawApiRequest request) throws StripeException {
    throw new UnsupportedOperationException(
        "rawRequest is unimplemented for this StripeResponseGetter");
  };
  /**
   * This method should e.g. throws an ApiKeyMissingError if a proper API Key cannot be determined
   * by the ResponseGetter or from the RequestOptions passed in.
   */
  default void validateRequestOptions(RequestOptions options) {}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy