-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1721 from stripe/richardm-stripe-client-usage
Report usage of `stripe_client`
- Loading branch information
Showing
141 changed files
with
656 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,49 @@ | ||
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<String, Object> params; | ||
|
||
private ApiRequest( | ||
BaseAddress baseAddress, | ||
ApiResource.RequestMethod method, | ||
String path, | ||
RequestOptions options, | ||
ApiMode apiMode, | ||
List<String> usage, | ||
Map<String, Object> params) { | ||
super(baseAddress, method, path, options, apiMode, usage); | ||
this.params = params; | ||
} | ||
|
||
public ApiRequest( | ||
BaseAddress baseAddress, | ||
ApiResource.RequestMethod method, | ||
String path, | ||
Map<String, Object> params, | ||
RequestOptions options, | ||
ApiMode apiMode) { | ||
super(baseAddress, method, path, options, apiMode); | ||
this.params = params; | ||
this(baseAddress, method, path, options, apiMode, null, params); | ||
} | ||
|
||
public ApiRequest addUsage(String usage) { | ||
List<String> 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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
package com.stripe.net; | ||
|
||
import java.util.List; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@AllArgsConstructor(access = AccessLevel.PROTECTED) | ||
class BaseApiRequest { | ||
private BaseAddress baseAddress; | ||
private ApiResource.RequestMethod method; | ||
private String path; | ||
private RequestOptions options; | ||
private ApiMode apiMode; | ||
private final BaseAddress baseAddress; | ||
private final ApiResource.RequestMethod method; | ||
private final String path; | ||
private final RequestOptions options; | ||
private final ApiMode apiMode; | ||
|
||
@Setter private List<String> usage; | ||
// TODO (major): Remove setter and make final | ||
private List<String> usage; | ||
|
||
public BaseApiRequest( | ||
BaseAddress baseAddress, | ||
ApiResource.RequestMethod method, | ||
String path, | ||
RequestOptions options, | ||
ApiMode apiMode) { | ||
this.baseAddress = baseAddress; | ||
this.method = method; | ||
this.path = path; | ||
this.options = options; | ||
this.apiMode = apiMode; | ||
/** @deprecated Use {@link com.stripe.net.ApiRequest#addUsage(String)} instead. */ | ||
@Deprecated | ||
public void setUsage(List<String> usage) { | ||
this.usage = usage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.