Skip to content

Commit 5eb497a

Browse files
docs: fix incorrect additional properties info (#737)
1 parent ffb6259 commit 5eb497a

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

README.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,7 @@ See [Pagination](#pagination) below for more information on transparently workin
151151

152152
To make a request to the Increase API, you generally build an instance of the appropriate `Params` class.
153153

154-
In [Example: creating a resource](#example-creating-a-resource) above, we used the `AccountCreateParams.builder()` to pass to the `create` method of the `accounts` service.
155-
156-
Sometimes, the API may support other properties that are not yet supported in the Java SDK types. In that case, you can attach them using the `putAdditionalProperty` method.
157-
158-
```java
159-
import com.increase.api.core.JsonValue;
160-
import com.increase.api.models.AccountCreateParams;
161-
162-
AccountCreateParams params = AccountCreateParams.builder()
163-
// ... normal properties
164-
.putAdditionalProperty("secret_param", JsonValue.from("4242"))
165-
.build();
166-
```
154+
See [Undocumented request params](#undocumented-request-params) for how to send arbitrary parameters.
167155

168156
## Responses
169157

@@ -371,18 +359,26 @@ This library is typed for convenient access to the documented API. If you need t
371359

372360
### Undocumented request params
373361

374-
To make requests using undocumented parameters, you can provide or override parameters on the params object while building it.
362+
In [Example: creating a resource](#example-creating-a-resource) above, we used the `AccountCreateParams.builder()` to pass to the `create` method of the `accounts` service.
363+
364+
Sometimes, the API may support other properties that are not yet supported in the Java SDK types. In that case, you can attach them using raw setters:
375365

376366
```java
377-
FooCreateParams address = FooCreateParams.builder()
378-
.id("my_id")
379-
.putAdditionalProperty("secret_prop", JsonValue.from("hello"))
367+
import com.increase.api.core.JsonValue;
368+
import com.increase.api.models.AccountCreateParams;
369+
370+
AccountCreateParams params = AccountCreateParams.builder()
371+
.putAdditionalHeader("Secret-Header", "42")
372+
.putAdditionalQueryParam("secret_query_param", "42")
373+
.putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))
380374
.build();
381375
```
382376

377+
You can also use the `putAdditionalProperty` method on nested headers, query params, or body objects.
378+
383379
### Undocumented response properties
384380

385-
To access undocumented response properties, you can use `res._additionalProperties()` on a response object to get a map of untyped fields of type `Map<String, JsonValue>`. You can then access fields like `._additionalProperties().get("secret_prop").asString()` or use other helpers defined on the `JsonValue` class to extract it to a desired type.
381+
To access undocumented response properties, you can use `res._additionalProperties()` on a response object to get a map of untyped fields of type `Map<String, JsonValue>`. You can then access fields like `res._additionalProperties().get("secret_prop").asString()` or use other helpers defined on the `JsonValue` class to extract it to a desired type.
386382

387383
## Logging
388384

0 commit comments

Comments
 (0)