Skip to content

Commit 89dae9b

Browse files
docs: fix incorrect additional properties info (#475)
1 parent 6ce718b commit 89dae9b

1 file changed

Lines changed: 14 additions & 18 deletions

File tree

README.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -179,19 +179,7 @@ Card.builder().state(State.of("NEW_STATE")).build()
179179

180180
To make a request to the Lithic API, you generally build an instance of the appropriate `Params` class.
181181

182-
In [Example: creating a resource](#example-creating-a-resource) above, we used the `CardCreateParams.builder()` to pass to the `create` method of the `cards` service.
183-
184-
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.
185-
186-
```java
187-
import com.lithic.api.core.JsonValue;
188-
import com.lithic.api.models.CardCreateParams;
189-
190-
CardCreateParams params = CardCreateParams.builder()
191-
// ... normal properties
192-
.putAdditionalProperty("secret_param", JsonValue.from("4242"))
193-
.build();
194-
```
182+
See [Undocumented request params](#undocumented-request-params) for how to send arbitrary parameters.
195183

196184
## Responses
197185

@@ -408,18 +396,26 @@ This library is typed for convenient access to the documented API. If you need t
408396

409397
### Undocumented request params
410398

411-
To make requests using undocumented parameters, you can provide or override parameters on the params object while building it.
399+
In [Example: creating a resource](#example-creating-a-resource) above, we used the `CardCreateParams.builder()` to pass to the `create` method of the `cards` service.
400+
401+
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:
412402

413403
```java
414-
FooCreateParams address = FooCreateParams.builder()
415-
.id("my_id")
416-
.putAdditionalProperty("secret_prop", JsonValue.from("hello"))
404+
import com.lithic.api.core.JsonValue;
405+
import com.lithic.api.models.CardCreateParams;
406+
407+
CardCreateParams params = CardCreateParams.builder()
408+
.putAdditionalHeader("Secret-Header", "42")
409+
.putAdditionalQueryParam("secret_query_param", "42")
410+
.putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))
417411
.build();
418412
```
419413

414+
You can also use the `putAdditionalProperty` method on nested headers, query params, or body objects.
415+
420416
### Undocumented response properties
421417

422-
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.
418+
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.
423419

424420
## Logging
425421

0 commit comments

Comments
 (0)