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

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

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

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import lombok.Getter;

@Getter
public class ApiRequest extends BaseApiRequest {
  private Map params;
  private final ApiMode apiMode;

  private ApiRequest(
      BaseAddress baseAddress,
      ApiResource.RequestMethod method,
      String path,
      RequestOptions options,
      List usage,
      Map params) {
    super(baseAddress, method, path, options, usage);
    this.params = params;
    this.apiMode = ApiMode.V1;
  }

  /**
   * @deprecated This constructor is for backward compatibility and will be removed by Sept 30, 2024
   */
  @Deprecated
  public ApiRequest(
      BaseAddress baseAddress,
      ApiResource.RequestMethod method,
      String path,
      Map params,
      RequestOptions options,
      ApiMode apiMode) {
    this(baseAddress, method, path, options, null, params);
  }

  public ApiRequest(
      BaseAddress baseAddress,
      ApiResource.RequestMethod method,
      String path,
      Map params,
      RequestOptions options) {
    this(baseAddress, method, path, options, null, params);
  }

  public ApiRequest addUsage(String usage) {
    List newUsage = new ArrayList<>();
    if (this.getUsage() != null) {
      newUsage.addAll(this.getUsage());
    }
    newUsage.add(usage);
    return new ApiRequest(
        this.getBaseAddress(),
        this.getMethod(),
        this.getPath(),
        this.getOptions(),
        newUsage,
        this.getParams());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy