Skip to content

Commit 41e6434

Browse files
committed
docs: cut comments that restate the code
1 parent 675ab4e commit 41e6434

49 files changed

Lines changed: 30 additions & 205 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎examples/src/main/java/com/synthient/examples/StreamExample.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public static void main(String[] args) throws InterruptedException {
2525
throw e;
2626
}
2727
System.err.println("stream: " + e);
28-
// Avoid reconnecting in a tight loop.
2928
Thread.sleep(2000);
3029
}
3130
}

‎grpcschema/src/main/java/com/synthient/grpcschema/FetchOptions.java‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import java.util.List;
66
import java.util.Set;
77

8-
/** Options for {@link GrpcSchema#fetch(String, FetchOptions)}. Build one with {@link #builder()}. */
98
public final class FetchOptions {
109
private final String endpoint;
1110
private final boolean plaintext;
@@ -29,7 +28,6 @@ public String endpoint() {
2928
return endpoint;
3029
}
3130

32-
/** Returns whether TLS is disabled. */
3331
public boolean plaintext() {
3432
return plaintext;
3533
}
@@ -44,7 +42,6 @@ public Duration timeout() {
4442
return timeout;
4543
}
4644

47-
/** Builds {@link FetchOptions}. */
4845
public static final class Builder {
4946
private String endpoint = "";
5047
private boolean plaintext;
@@ -95,7 +92,6 @@ public Builder timeout(Duration timeout) {
9592
return this;
9693
}
9794

98-
/** Returns the options. */
9995
public FetchOptions build() {
10096
return new FetchOptions(this);
10197
}

‎grpcschema/src/main/java/com/synthient/grpcschema/GrpcSchema.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
* }
4141
*/
4242
public final class GrpcSchema {
43-
/** The address of the Synthient gRPC API. */
4443
public static final String DEFAULT_ENDPOINT = "grpc.synthient.com:443";
4544

4645
private static final int MAX_MESSAGE_SIZE = 32 << 20;

‎src/main/java/com/synthient/ApiException.java‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public class ApiException extends SynthientException {
4040
/**
4141
* Creates an API exception, for example to stub the SDK in tests.
4242
*
43-
* @param statusCode the HTTP status
4443
* @param type the problem type URI, or empty
4544
* @param title the problem title, or empty
4645
* @param detail the problem detail, or empty
@@ -91,7 +90,6 @@ static ApiException fromResponse(int statusCode, Headers headers, byte[] body, @
9190
readFailure);
9291
}
9392

94-
/** Parses a JSON object, returning a missing node for anything else. */
9593
private static JsonNode parseObject(byte[] body) {
9694
try {
9795
JsonNode node = Json.MAPPER.readTree(body);
@@ -147,7 +145,6 @@ private static String message(int statusCode) {
147145
return reason.isEmpty() ? String.valueOf(statusCode) : statusCode + " " + reason;
148146
}
149147

150-
/** Returns the HTTP status. */
151148
public int statusCode() {
152149
return statusCode;
153150
}

‎src/main/java/com/synthient/EventStream.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
*
3030
* <p>{@link #iterator()} may be called once. {@link #close()} may be called from another thread, which ends
3131
* the iteration.
32-
*
33-
* @param <T> the event type
3432
*/
3533
public final class EventStream<T> implements Iterable<T>, Closeable {
3634
private static final int MAX_EVENT_SIZE = 16 << 20;
@@ -48,7 +46,7 @@ public final class EventStream<T> implements Iterable<T>, Closeable {
4846
}
4947

5048
/**
51-
* Returns the events of the stream. Reading blocks until the server sends the next event.
49+
* Reading blocks until the server sends the next event.
5250
*
5351
* @throws IllegalStateException if called more than once
5452
*/
@@ -132,7 +130,7 @@ private static boolean isBlank(byte[] bytes) {
132130
return true;
133131
}
134132

135-
/** Disconnects from the feed. Safe to call more than once and from any thread. */
133+
/** Safe to call more than once and from any thread. */
136134
@Override
137135
public void close() {
138136
closed = true;

‎src/main/java/com/synthient/Feed.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ static String exportPath(String id) {
230230
throw new IllegalArgumentException("invalid export ID \"" + id + "\"");
231231
}
232232

233-
/** Rejects a redirect that carries user info or downgrades from https to http. */
234233
static void checkRedirect(HttpUrl from, HttpUrl target) {
235234
if (!target.username().isEmpty() || !target.password().isEmpty()) {
236235
throw new SynthientException("export redirect has an unsupported location");

‎src/main/java/com/synthient/Json.java‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import tools.jackson.databind.json.JsonMapper;
99
import tools.jackson.databind.type.LogicalType;
1010

11-
/** The JSON mapper shared by every client. It is immutable and safe for concurrent use. */
1211
final class Json {
1312
/**
1413
* Rejects values of the wrong JSON type, such as {@code "15169"} for a number or {@code 15169} for a
@@ -26,11 +25,7 @@ final class Json {
2625

2726
private Json() {}
2827

29-
/**
30-
* Decodes a JSON object into a model.
31-
*
32-
* @throws SynthientException if the body is not a valid instance of the model
33-
*/
28+
/** @throws SynthientException if the body is not a valid instance of the model */
3429
static <T> T decode(byte[] body, Class<T> type) {
3530
T value;
3631
try {

‎src/main/java/com/synthient/RateLimit.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* organization and are shared by all of its keys.
1010
*
1111
* @param limit the bucket size
12-
* @param remaining the requests left in the bucket
1312
* @param reset the time until the bucket is full again
1413
*/
1514
public record RateLimit(int limit, int remaining, Duration reset) {

‎src/main/java/com/synthient/ResponseMetadata.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
/**
99
* Metadata of one API response, passed to the {@link SynthientClient.Builder#responseHook response hook}.
1010
*
11-
* @param statusCode the HTTP status
1211
* @param requestId the {@code X-Request-Id} header, or an empty string
1312
* @param rateLimit the rate limit state, or null when the response has no complete {@code RateLimit-*}
1413
* headers

‎src/main/java/com/synthient/SynthientClient.java‎

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public final class SynthientClient implements AutoCloseable {
4949
/** The SDK version, sent in the {@code User-Agent} header. */
5050
public static final String VERSION = "1.0.0";
5151

52-
/** The production API. */
5352
public static final String DEFAULT_BASE_URL = "https://api.synthient.com/api/v4";
5453

5554
private static final int MAX_BATCH_SIZE = 1000;
@@ -68,11 +67,7 @@ public SynthientClient() {
6867
this(builder());
6968
}
7069

71-
/**
72-
* Creates a client with an API key.
73-
*
74-
* @throws IllegalArgumentException if the key is blank or not printable ASCII
75-
*/
70+
/** @throws IllegalArgumentException if the key is blank or not printable ASCII */
7671
public SynthientClient(String apiKey) {
7772
this(builder().apiKey(apiKey));
7873
}
@@ -99,13 +94,12 @@ private SynthientClient(Builder builder) {
9994
builder.sleeper);
10095
}
10196

102-
/** Returns a builder for a client with custom options. */
10397
public static Builder builder() {
10498
return new Builder();
10599
}
106100

107101
/**
108-
* Looks up an IP address. Costs one credit; failed lookups are free.
102+
* Costs one credit; failed lookups are free.
109103
*
110104
* @param ip an IPv4 or IPv6 address literal
111105
* @throws IllegalArgumentException if {@code ip} is not an address literal; no request is sent
@@ -200,7 +194,7 @@ public void health() {
200194
transport.call("GET", transport.url("health").build(), null, Transport.Policy.RATE_LIMIT, JsonNode.class);
201195
}
202196

203-
/** Returns the proxies feed. Streaming needs the {@code PROXY_FIREHOSE} scope and exports {@code PROXY_FEEDS}. */
197+
/** Streaming needs the {@code PROXY_FIREHOSE} scope and exports {@code PROXY_FEEDS}. */
204198
public Feed<ProxyEvent> proxies() {
205199
return new Feed<>(transport, "feeds/proxies", ProxyEvent.class);
206200
}
@@ -210,7 +204,7 @@ public Feed<AnonymizerEvent> anonymizers() {
210204
return new Feed<>(transport, "feeds/anonymizers", AnonymizerEvent.class);
211205
}
212206

213-
/** Returns the torrents feed. */
207+
/** Returns the BitTorrent DHT and tracker feed. */
214208
public Feed<TorrentEvent> torrents() {
215209
return new Feed<>(transport, "feeds/torrents", TorrentEvent.class);
216210
}
@@ -275,7 +269,7 @@ record BatchResponse(@JsonProperty("results") List<IpInfo> results) {
275269
}
276270
}
277271

278-
/** Builds a {@link SynthientClient}. A builder can be reused; each build creates an independent client. */
272+
/** A builder can be reused; each build creates an independent client. */
279273
public static final class Builder {
280274
private @Nullable String apiKey;
281275
private HttpUrl baseUrl = HttpUrl.get(DEFAULT_BASE_URL);
@@ -289,14 +283,14 @@ public static final class Builder {
289283

290284
private Builder() {}
291285

292-
/** Sets the API key. Without one, the client reads {@code SYNTHIENT_API_KEY}. */
286+
/** Defaults to the {@code SYNTHIENT_API_KEY} environment variable. */
293287
public Builder apiKey(String apiKey) {
294288
this.apiKey = requireNonNull(apiKey, "apiKey");
295289
return this;
296290
}
297291

298292
/**
299-
* Sets the API base URL, by default {@value SynthientClient#DEFAULT_BASE_URL}.
293+
* Defaults to {@value SynthientClient#DEFAULT_BASE_URL}.
300294
*
301295
* @throws IllegalArgumentException if the URL is not http or https, has no host, or has user info, a
302296
* query, or a fragment

0 commit comments

Comments
 (0)