-
Notifications
You must be signed in to change notification settings - Fork 373
Report usage of stripe_client
#1721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f8aacff
implementation
richardm-stripe f03b081
Handle null better
richardm-stripe 758af8f
Codegen
richardm-stripe 57c01eb
Collections.emptyList()
richardm-stripe c8ebc2c
Improve test infra
richardm-stripe 63c67b8
Move and simplify global client telemetry test
richardm-stripe b4867b5
format
richardm-stripe 2209737
Remove vestigial code
richardm-stripe 4f8883c
Immutable BaseApiRequest
richardm-stripe f28076b
codegen
richardm-stripe 1ec0121
Fix bug
richardm-stripe 58244ca
Fix compat
richardm-stripe 9f15662
format
richardm-stripe 27097f3
Restrict StripeRequest.usage visibility
richardm-stripe 67348d7
Merge remote-tracking branch 'origin/master' into richardm-stripe-cli…
richardm-stripe 90cf4b9
withAddedUsage -> addUsage
richardm-stripe 6f7126a
Fix reference
richardm-stripe d18be39
Remove StripeRequest.usage
richardm-stripe 7d87cb6
Remove extra usage
richardm-stripe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 withAddedUsage(String usage) { | ||
richardm-stripe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 hidden or 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 { | ||
richardm-stripe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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#withAddedUsage(String)} instead. */ | ||
@Deprecated | ||
public void setUsage(List<String> usage) { | ||
this.usage = usage; | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.