Skip to content

Commit a917ac3

Browse files
authored
Merge pull request #729 from stripe/ob-javadoc
Add missing Javadoc
2 parents 173eda0 + 2f4c0a2 commit a917ac3

File tree

5 files changed

+160
-36
lines changed

5 files changed

+160
-36
lines changed

src/main/java/com/stripe/model/EphemeralKey.java

+30-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.stripe.model;
22

3+
import com.google.gson.annotations.SerializedName;
4+
35
import com.stripe.exception.StripeException;
46
import com.stripe.net.ApiResource;
57
import com.stripe.net.RequestOptions;
@@ -15,18 +17,40 @@
1517
@Setter
1618
@EqualsAndHashCode(callSuper = false)
1719
public class EphemeralKey extends ApiResource implements HasId {
18-
@Getter(onMethod = @__({@Override})) String id;
19-
String object;
20+
/** Time at which the object was created. Measured in seconds since the Unix epoch. */
21+
@SerializedName("created")
2022
Long created;
23+
24+
/** Time at which the key will expire. Measured in seconds since the Unix epoch. */
25+
@SerializedName("expires")
2126
Long expires;
27+
28+
/** Unique identifier for the object. */
29+
@Getter(onMethod = @__({@Override}))
30+
@SerializedName("id")
31+
String id;
32+
33+
/**
34+
* Has the value {@code true} if the object exists in live mode or the value {@code false} if
35+
* the object exists in test mode.
36+
*/
37+
@SerializedName("livemode")
2238
Boolean livemode;
39+
40+
/** String representing the object's type. Objects of the same type share the same value. */
41+
@SerializedName("object")
42+
String object;
43+
44+
/** The key's secret. You can use this value to make authorized requests to the Stripe API. */
45+
@SerializedName("secret")
2346
String secret;
47+
2448
List<AssociatedObject> associatedObjects;
49+
2550
transient String rawJson;
2651

27-
// <editor-fold desc="create">
2852
/**
29-
* Creates an ephemeral key.
53+
* Creates an ephemeral API key for a given resource.
3054
*
3155
* @param params request parameters
3256
* @param options request options. {@code stripeVersion} is required when creating ephemeral
@@ -43,24 +67,21 @@ public static EphemeralKey create(Map<String, Object> params, RequestOptions opt
4367
return request(RequestMethod.POST, classUrl(EphemeralKey.class), params, EphemeralKey.class,
4468
options);
4569
}
46-
// </editor-fold>
4770

48-
// <editor-fold desc="delete">
4971
/**
50-
* Delete an ephemeral key.
72+
* Invalidates an ephemeral API key for a given resource.
5173
*/
5274
public EphemeralKey delete() throws StripeException {
5375
return delete(null);
5476
}
5577

5678
/**
57-
* Delete an ephemeral key.
79+
* Invalidates an ephemeral API key for a given resource.
5880
*/
5981
public EphemeralKey delete(RequestOptions options) throws StripeException {
6082
return request(RequestMethod.DELETE, instanceUrl(EphemeralKey.class, this.id),
6183
(Map<String,Object>) null, EphemeralKey.class, options);
6284
}
63-
// </editor-fold>
6485

6586
@Getter
6687
@Setter

src/main/java/com/stripe/model/Event.java

+59-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.stripe.model;
22

3+
import com.google.gson.annotations.SerializedName;
4+
35
import com.stripe.exception.StripeException;
46
import com.stripe.net.ApiResource;
57
import com.stripe.net.RequestOptions;
@@ -14,15 +16,56 @@
1416
@Setter
1517
@EqualsAndHashCode(callSuper = false)
1618
public class Event extends ApiResource implements HasId {
17-
@Getter(onMethod = @__({@Override})) String id;
18-
String object;
19+
/** For Connect webhook events, the identifier of the account that emitted the event. */
20+
@SerializedName("account")
1921
String account;
22+
23+
/**
24+
* The Stripe API version used to render {@code data}. <i>Note: This property is populated only
25+
* for events on or after October 31, 2014.</i>
26+
*/
27+
@SerializedName("api_version")
2028
String apiVersion;
29+
30+
/** Time at which the object was created. Measured in seconds since the Unix epoch. */
31+
@SerializedName("created")
2132
Long created;
33+
34+
/** Object containing data associated with the event. */
35+
@SerializedName("data")
2236
EventData data;
37+
38+
/** Unique identifier for the object. */
39+
@Getter(onMethod = @__({@Override}))
40+
@SerializedName("id")
41+
String id;
42+
43+
/**
44+
* Has the value {@code true} if the object exists in live mode or the value {@code false} if
45+
* the object exists in test mode.
46+
*/
47+
@SerializedName("livemode")
2348
Boolean livemode;
49+
50+
/** String representing the object's type. Objects of the same type share the same value. */
51+
@SerializedName("object")
52+
String object;
53+
54+
/**
55+
* Number of webhooks that have yet to be successfully delivered (i.e., to return a 20x
56+
* response) to the URLs you’ve specified.
57+
*/
58+
@SerializedName("pending_webhooks")
2459
Long pendingWebhooks;
60+
61+
/** Information on the API request that instigated the event. */
62+
@SerializedName("request")
2563
EventRequest request;
64+
65+
/**
66+
* Description of the event (e.g., {@code invoice.created} or {@code charge.refunded}).
67+
*/
68+
@SerializedName("type")
2669
String type;
2770

2871
/**
@@ -51,44 +94,49 @@ public EventDataObjectDeserializer getDataObjectDeserializer() {
5194
return new EventDataObjectDeserializer(apiVersion, type, data.object);
5295
}
5396

54-
// <editor-fold desc="list">
5597
/**
56-
* List all events.
98+
* List events, going back up to 30 days. Each event data is rendered according to Stripe API
99+
* version at its creation time, specified in
100+
* <a href="https://stripe.com/docs/api/events/object">event object</a> {@code api_version}
101+
* attribute (not according to your current Stripe API version or {@code Stripe-Version} header).
57102
*/
58103
public static EventCollection list(Map<String, Object> params) throws StripeException {
59104
return list(params, null);
60105
}
61106

62107
/**
63-
* List all events.
108+
* List events, going back up to 30 days. Each event data is rendered according to Stripe API
109+
* version at its creation time, specified in
110+
* <a href="https://stripe.com/docs/api/events/object">event object</a> {@code api_version}
111+
* attribute (not according to your current Stripe API version or {@code Stripe-Version} header).
64112
*/
65113
public static EventCollection list(Map<String, Object> params, RequestOptions options)
66114
throws StripeException {
67115
return requestCollection(classUrl(Event.class), params, EventCollection.class, options);
68116
}
69-
// </editor-fold>
70117

71-
// <editor-fold desc="retrieve">
72118
/**
73-
* Retrieve an event.
119+
* Retrieves the details of an event. Supply the unique identifier of the event, which you might
120+
* have received in a webhook.
74121
*/
75122
public static Event retrieve(String id) throws StripeException {
76123
return retrieve(id, (RequestOptions) null);
77124
}
78125

79126
/**
80-
* Retrieve an event.
127+
* Retrieves the details of an event. Supply the unique identifier of the event, which you might
128+
* have received in a webhook.
81129
*/
82130
public static Event retrieve(String id, RequestOptions options) throws StripeException {
83131
return retrieve(id, null, options);
84132
}
85133

86134
/**
87-
* Retrieve an event.
135+
* Retrieves the details of an event. Supply the unique identifier of the event, which you might
136+
* have received in a webhook.
88137
*/
89138
public static Event retrieve(String id, Map<String, Object> params, RequestOptions options)
90139
throws StripeException {
91140
return request(RequestMethod.GET, instanceUrl(Event.class, id), params, Event.class, options);
92141
}
93-
// </editor-fold>
94142
}

src/main/java/com/stripe/model/EventData.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.google.gson.JsonObject;
44
import com.google.gson.JsonParseException;
5+
import com.google.gson.annotations.SerializedName;
56
import java.util.Map;
67
import lombok.EqualsAndHashCode;
78
import lombok.Getter;
@@ -15,6 +16,7 @@ public class EventData extends StripeObject {
1516
* Raw JSON object intended to be deserialized as {@code StripeObject}. The deserialization
1617
* should be deferred to the user. See the now deprecated method {@link EventData#getObject()}.
1718
*/
19+
@SerializedName("object")
1820
JsonObject object;
1921

2022
/**
@@ -23,6 +25,7 @@ public class EventData extends StripeObject {
2325
* {@code Map<String, Object>}, {@code List<Object>}, and basic Java data types.
2426
* The array was previously represented as {@code Object[]} in `stripe-java` below v9.x
2527
*/
28+
@SerializedName("previous_attributes")
2629
Map<String, Object> previousAttributes;
2730

2831
/**
@@ -36,4 +39,4 @@ public class EventData extends StripeObject {
3639
public StripeObject getObject() {
3740
return EventDataDeserializer.deserializeStripeObject(object);
3841
}
39-
}
42+
}

src/main/java/com/stripe/model/EventRequest.java

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.stripe.model;
22

3+
import com.google.gson.annotations.SerializedName;
4+
35
import lombok.EqualsAndHashCode;
46
import lombok.Getter;
57
import lombok.Setter;
@@ -8,6 +10,14 @@
810
@Setter
911
@EqualsAndHashCode(callSuper = false)
1012
public class EventRequest extends StripeObject {
13+
/** ID of the API request that caused the event. If null, the event was automatic (e.g., Stripe’s
14+
* automatic subscription handling). Request logs are available in the
15+
* <a href="https://dashboard.stripe.com/logs">dashboard</a>, but currently not in the API. */
16+
@SerializedName("id")
1117
String id;
18+
19+
/** The idempotency key transmitted during the request, if any. <i>Note: This property is
20+
* populated only for events on or after May 23, 2017.</i> */
21+
@SerializedName("idempotency_key")
1222
String idempotencyKey;
1323
}
+57-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.stripe.model;
22

3+
import com.google.gson.annotations.SerializedName;
4+
35
import com.stripe.Stripe;
46
import com.stripe.exception.StripeException;
57
import com.stripe.net.ApiResource;
@@ -15,73 +17,113 @@
1517
@Setter
1618
@EqualsAndHashCode(callSuper = false)
1719
public class File extends ApiResource implements HasId {
18-
@Getter(onMethod = @__({@Override})) String id;
19-
String object;
20+
/** Time at which the object was created. Measured in seconds since the Unix epoch. */
21+
@SerializedName("created")
2022
Long created;
23+
24+
/** A filename for the file, suitable for saving to a filesystem. */
25+
@SerializedName("filename")
2126
String filename;
27+
28+
/** Unique identifier for the object. */
29+
@Getter(onMethod = @__({@Override}))
30+
@SerializedName("id")
31+
String id;
32+
33+
@SerializedName("links")
2234
FileLinkCollection links;
35+
36+
/** String representing the object's type. Objects of the same type share the same value. */
37+
@SerializedName("object")
38+
String object;
39+
40+
/**
41+
* The purpose of the file. Possible values are {@code business_icon}, {@code business_logo},
42+
* {@code customer_signature}, {@code dispute_evidence}, {@code finance_report_run},
43+
* {@code identity_document}, {@code pci_document}, {@code sigma_scheduled_query}, or
44+
* {@code tax_document_user_upload}.
45+
*/
46+
@SerializedName("purpose")
2347
String purpose;
48+
49+
/** The size in bytes of the file object. */
50+
@SerializedName("size")
2451
Long size;
52+
53+
/** A user friendly title for the document. */
54+
@SerializedName("title")
2555
String title;
56+
57+
/**
58+
* The type of the file returned (e.g., {@code csv}, {@code pdf}, {@code jpg}, or
59+
* {@code png}).
60+
*/
61+
@SerializedName("type")
2662
String type;
63+
64+
/** The URL from which the file can be downloaded using your live secret API key. */
65+
@SerializedName("url")
2766
String url;
2867

29-
// <editor-fold desc="create">
3068
/**
31-
* Create a file.
69+
* To upload a file to Stripe, you’ll need to send a request of type {@code multipart/form-data}.
70+
* The request should contain the file you would like to upload, as well as the parameters for
71+
* creating a file.
3272
*/
3373
public static File create(Map<String, Object> params) throws StripeException {
3474
return create(params, (RequestOptions) null);
3575
}
3676

3777
/**
38-
* Create a file.
78+
* To upload a file to Stripe, you’ll need to send a request of type {@code multipart/form-data}.
79+
* The request should contain the file you would like to upload, as well as the parameters for
80+
* creating a file.
3981
*/
4082
public static File create(Map<String, Object> params, RequestOptions options)
4183
throws StripeException {
4284
return multipartRequest(RequestMethod.POST, classUrl(File.class, Stripe.getUploadBase()),
4385
params, File.class, options);
4486
}
45-
// </editor-fold>
4687

47-
// <editor-fold desc="list">
4888
/**
49-
* List all files.
89+
* Returns a list of the files that your account has access to. The files are returned sorted by
90+
* creation date, with the most recently created files appearing first.
5091
*/
5192
public static FileCollection list(Map<String, Object> params) throws StripeException {
5293
return list(params, null);
5394
}
5495

5596
/**
56-
* List all files.
97+
* Returns a list of the files that your account has access to. The files are returned sorted by
98+
* creation date, with the most recently created files appearing first.
5799
*/
58100
public static FileCollection list(Map<String, Object> params, RequestOptions options)
59101
throws StripeException {
60102
return requestCollection(classUrl(File.class), params, FileCollection.class, options);
61103
}
62-
// </editor-fold>
63104

64-
// <editor-fold desc="retrieve">
65105
/**
66-
* Retrieve a file.
106+
* Retrieves the details of an existing file object. Supply the unique file ID from a file, and
107+
* Stripe will return the corresponding file object.
67108
*/
68109
public static File retrieve(String id) throws StripeException {
69110
return retrieve(id, (RequestOptions) null);
70111
}
71112

72113
/**
73-
* Retrieve a file.
114+
* Retrieves the details of an existing file object. Supply the unique file ID from a file, and
115+
* Stripe will return the corresponding file object.
74116
*/
75117
public static File retrieve(String id, RequestOptions options) throws StripeException {
76118
return retrieve(id, null, options);
77119
}
78120

79121
/**
80-
* Retrieve a file.
122+
* Retrieves the details of an existing file object. Supply the unique file ID from a file, and
123+
* Stripe will return the corresponding file object.
81124
*/
82125
public static File retrieve(String id, Map<String, Object> params, RequestOptions options)
83126
throws StripeException {
84127
return request(RequestMethod.GET, instanceUrl(File.class, id), params, File.class, options);
85128
}
86-
// </editor-fold>
87129
}

0 commit comments

Comments
 (0)