You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: V4_MIGRATION_GUIDE.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,35 @@ implementation 'com.google.code.gson:gson:2.8.9' // your preferred version
96
96
97
97
> **Note:** Pinning or excluding is not recommended long-term, as the SDK has been tested and validated against Gson 2.11.0.
98
98
99
+
### DefaultClient.Builder
100
+
101
+
v4 introduces a `DefaultClient.Builder` for configuring the HTTP client. This replaces the constructor-based approach with a more flexible builder pattern that supports additional options such as write/call timeouts, custom interceptors, and custom loggers.
102
+
103
+
**v3 (constructor-based — deprecated):**
104
+
105
+
```kotlin
106
+
// ⚠️ Deprecated: still compiles but shows a warning
107
+
val client =DefaultClient(
108
+
connectTimeout =30,
109
+
readTimeout =30,
110
+
enableLogging =true
111
+
)
112
+
```
113
+
114
+
**v4 (builder pattern — recommended):**
115
+
116
+
```kotlin
117
+
val client =DefaultClient.Builder()
118
+
.connectTimeout(30)
119
+
.readTimeout(30)
120
+
.writeTimeout(30)
121
+
.callTimeout(120)
122
+
.enableLogging(true)
123
+
.build()
124
+
```
125
+
126
+
The legacy constructor is deprecated but **not removed** — existing code will continue to compile and run. Your IDE will show a deprecation warning with a suggested `ReplaceWith` quick-fix to migrate to the Builder.
* Builder for creating a [DefaultClient] instance with custom configuration.
40
48
*
41
-
* @param connectTimeout the connection timeout, in seconds, to use when executing requests. Default is ten seconds.
42
-
* @param readTimeout the read timeout, in seconds, to use when executing requests. Default is ten seconds.
43
-
* @param defaultHeaders any headers that should be sent on all requests. If a specific request specifies a header with the same key as any header in the default headers, the header specified on the request will take precedence. Default is an empty map.
44
-
* @param enableLogging whether HTTP request and response info should be logged. This should only be set to `true` for debugging purposes in non-production environments, as sensitive information is included in the logs. Defaults to `false`.
0 commit comments