com.stripe.net.ApiRequest Maven / Gradle / Ivy
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());
}
}