-
Notifications
You must be signed in to change notification settings - Fork 578
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
Switch RequestOption
to accept long timeout only
#6289
Merged
Merged
Conversation
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
The `RequestOptions` class only customizable paramter, `timeout`, is now called `timeoutInMillis` and it's type is `Long`. Using `kotlin.time.Duration` in our public API, while convenient, introduces an issue with Java code. In short, `Duration` is exposed as `long` in the JVM, and that long can represent time in milliseconds, or nanoseconds. For clarity, we've fallback to long. This change also removes the internal representation of `RequestOptions`, which was a legacy implementation detail.
Javadoc Changes:--- /home/runner/diff/original/firebase-kotlindoc/android/com/google/firebase/vertexai/type/RequestOptions.html 2024-09-21 00:40:34.129223666 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/android/com/google/firebase/vertexai/type/RequestOptions.html 2024-09-21 00:38:27.221189863 +0000
@@ -21,20 +21,25 @@
</colgroup>
<thead>
<tr>
- <th colspan="100%"><h3>Public fields</h3></th>
+ <th colspan="100%"><h3>Public constructors</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
- <td><code>final @<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/index.html">Duration</a></code></td>
<td>
- <div><code><a href="/docs/reference/android/com/google/firebase/vertexai/type/RequestOptions.html#timeout()">timeout</a></code></div>
- <p>the maximum amount of time for a request to take, from the first request to first response.</p>
+ <div><code><a href="/docs/reference/android/com/google/firebase/vertexai/type/RequestOptions.html#RequestOptions(kotlin.Long)">RequestOptions</a>(long timeoutInMillis)</code></div>
+ <p>Constructor for RequestOptions.</p>
</td>
</tr>
</tbody>
</table>
</div>
+ <div class="list">
+ <h2>Public constructors</h2>
+ <div class="api-item"><a name="RequestOptions-kotlin.Long-"></a><a name="requestoptions"></a>
+ <h3 class="api-name" id="RequestOptions(kotlin.Long)">RequestOptions</h3>
+ <pre class="api-signature no-pretty-print">public <a href="/docs/reference/android/com/google/firebase/vertexai/type/RequestOptions.html#RequestOptions(kotlin.Long)">RequestOptions</a>(long timeoutInMillis)</pre>
+ <p>Constructor for RequestOptions.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
@@ -43,40 +48,19 @@
</colgroup>
<thead>
<tr>
- <th colspan="100%"><h3>Public constructors</h3></th>
+ <th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
+ <td><code>long timeoutInMillis</code></td>
<td>
- <div><code><a href="/docs/reference/android/com/google/firebase/vertexai/type/RequestOptions.html#RequestOptions(kotlin.time.Duration)">RequestOptions</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/index.html">Duration</a> timeout)</code></div>
- </td>
- </tr>
- <tr>
- <td>
- <div><code><a href="/docs/reference/android/com/google/firebase/vertexai/type/RequestOptions.html#RequestOptions(kotlin.Long)">RequestOptions</a>(<a href="https://developer.android.com/reference/kotlin/java/lang/Long.html">Long</a> timeout)</code></div>
+ <p>the maximum amount of time, in milliseconds, for a request to take, from the first request to first response.</p>
</td>
</tr>
</tbody>
</table>
</div>
- <div class="list">
- <h2>Public fields</h2>
- <div class="api-item"><a name="getTimeout()"></a><a name="setTimeout()"></a><a name="getTimeout--"></a><a name="setTimeout--"></a>
- <h3 class="api-name" id="timeout()">timeout</h3>
- <pre class="api-signature no-pretty-print">public final @<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/index.html">Duration</a> <a href="/docs/reference/android/com/google/firebase/vertexai/type/RequestOptions.html#timeout()">timeout</a></pre>
- <p>the maximum amount of time for a request to take, from the first request to first response.</p>
- </div>
- </div>
- <div class="list">
- <h2>Public constructors</h2>
- <div class="api-item"><a name="RequestOptions-kotlin.time.Duration-"></a><a name="requestoptions"></a>
- <h3 class="api-name" id="RequestOptions(kotlin.time.Duration)">RequestOptions</h3>
- <pre class="api-signature no-pretty-print">public <a href="/docs/reference/android/com/google/firebase/vertexai/type/RequestOptions.html#RequestOptions(kotlin.time.Duration)">RequestOptions</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/index.html">Duration</a> timeout)</pre>
- </div>
- <div class="api-item"><a name="RequestOptions-kotlin.Long-"></a><a name="requestoptions"></a>
- <h3 class="api-name" id="RequestOptions(kotlin.Long)">RequestOptions</h3>
- <pre class="api-signature no-pretty-print">public <a href="/docs/reference/android/com/google/firebase/vertexai/type/RequestOptions.html#RequestOptions(kotlin.Long)">RequestOptions</a>(<a href="https://developer.android.com/reference/kotlin/java/lang/Long.html">Long</a> timeout)</pre>
</div>
</div>
</body> --- /home/runner/diff/original/firebase-kotlindoc/kotlin/com/google/firebase/vertexai/type/RequestOptions.html 2024-09-21 00:40:34.122223663 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/kotlin/com/google/firebase/vertexai/type/RequestOptions.html 2024-09-21 00:38:27.211189862 +0000
@@ -27,17 +27,19 @@
<tbody class="list">
<tr>
<td>
- <div><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/RequestOptions.html#RequestOptions(kotlin.time.Duration)">RequestOptions</a>(timeout: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/index.html">Duration</a>)</code></div>
- </td>
- </tr>
- <tr>
- <td>
- <div><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/RequestOptions.html#RequestOptions(kotlin.Long)">RequestOptions</a>(timeout: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>?)</code></div>
+ <div><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/RequestOptions.html#RequestOptions(kotlin.Long)">RequestOptions</a>(timeoutInMillis: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>)</code></div>
+ <p>Constructor for RequestOptions.</p>
</td>
</tr>
</tbody>
</table>
</div>
+ <div class="list">
+ <h2>Public constructors</h2>
+ <div class="api-item"><a name="RequestOptions-kotlin.Long-"></a><a name="requestoptions"></a>
+ <h3 class="api-name" id="RequestOptions(kotlin.Long)">RequestOptions</h3>
+ <pre class="api-signature no-pretty-print"><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/RequestOptions.html#RequestOptions(kotlin.Long)">RequestOptions</a>(timeoutInMillis: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a> = 180.seconds.inWholeMilliseconds)</pre>
+ <p>Constructor for RequestOptions.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
@@ -46,37 +48,19 @@
</colgroup>
<thead>
<tr>
- <th colspan="100%"><h3>Public properties</h3></th>
+ <th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
- <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/index.html">Duration</a></code></td>
+ <td><code>timeoutInMillis: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a> = 180.seconds.inWholeMilliseconds</code></td>
<td>
- <div><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/RequestOptions.html#timeout()">timeout</a></code></div>
- <p>the maximum amount of time for a request to take, from the first request to first response.</p>
+ <p>the maximum amount of time, in milliseconds, for a request to take, from the first request to first response.</p>
</td>
</tr>
</tbody>
</table>
</div>
- <div class="list">
- <h2>Public constructors</h2>
- <div class="api-item"><a name="RequestOptions-kotlin.time.Duration-"></a><a name="requestoptions"></a>
- <h3 class="api-name" id="RequestOptions(kotlin.time.Duration)">RequestOptions</h3>
- <pre class="api-signature no-pretty-print"><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/RequestOptions.html#RequestOptions(kotlin.time.Duration)">RequestOptions</a>(timeout: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/index.html">Duration</a>)</pre>
- </div>
- <div class="api-item"><a name="RequestOptions-kotlin.Long-"></a><a name="requestoptions"></a>
- <h3 class="api-name" id="RequestOptions(kotlin.Long)">RequestOptions</h3>
- <pre class="api-signature no-pretty-print"><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/RequestOptions.html#RequestOptions(kotlin.Long)">RequestOptions</a>(timeout: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>? = Long.MAX_VALUE)</pre>
- </div>
- </div>
- <div class="list">
- <h2>Public properties</h2>
- <div class="api-item"><a name="getTimeout()"></a><a name="setTimeout()"></a><a name="getTimeout--"></a><a name="setTimeout--"></a>
- <h3 class="api-name" id="timeout()">timeout</h3>
- <pre class="api-signature no-pretty-print">val <a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/RequestOptions.html#timeout()">timeout</a>: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/index.html">Duration</a></pre>
- <p>the maximum amount of time for a request to take, from the first request to first response.</p>
</div>
</div>
</body> |
Generated by 🚫 Danger |
Coverage Report 1Affected ProductsNo changes between base commit (da0eefa) and merge commit (353c7c7).Test Logs |
Size Report 1Affected Products
Test Logs |
Unit Test Results 16 files + 8 16 suites +8 16s ⏱️ -12s Results for commit 6a4e35c. ± Comparison against base commit da0eefa. This pull request removes 22 and adds 108 tests. Note that renamed tests count towards both.
|
daymxn
approved these changes
Sep 23, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The
RequestOptions
class only customizable paramter,timeout
, is now calledtimeoutInMillis
and it's type isLong
.Using
kotlin.time.Duration
in our public API, while convenient, introduces an issue with Java code. In short,Duration
is exposed aslong
in the JVM, and that long can represent time in milliseconds, or nanoseconds.For clarity, we've fallback to long.
b/368715556