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 ApiRequest(
      BaseAddress baseAddress,
      ApiResource.RequestMethod method,
      String path,
      RequestOptions options,
      ApiMode apiMode,
      List usage,
      Map params) {
    super(baseAddress, method, path, options, apiMode, usage);
    this.params = params;
  }

  public ApiRequest(
      BaseAddress baseAddress,
      ApiResource.RequestMethod method,
      String path,
      Map params,
      RequestOptions options,
      ApiMode apiMode) {
    this(baseAddress, method, path, options, apiMode, 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(),
        this.getApiMode(),
        newUsage,
        this.getParams());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy