Skip to content

Commit 5d81eac

Browse files
docs: fix incorrect additional properties info (#227)
1 parent 7aaa5dc commit 5d81eac

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
@@ -140,19 +140,7 @@ See [Pagination](#pagination) below for more information on transparently workin
140140

141141
To make a request to the Orb API, you generally build an instance of the appropriate `Params` class.
142142

143-
In [Example: creating a resource](#example-creating-a-resource) above, we used the `CustomerCreateParams.builder()` to pass to the `create` method of the `customers` service.
144-
145-
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.
146-
147-
```java
148-
import com.withorb.api.core.JsonValue;
149-
import com.withorb.api.models.CustomerCreateParams;
150-
151-
CustomerCreateParams params = CustomerCreateParams.builder()
152-
// ... normal properties
153-
.putAdditionalProperty("secret_param", JsonValue.from("4242"))
154-
.build();
155-
```
143+
See [Undocumented request params](#undocumented-request-params) for how to send arbitrary parameters.
156144

157145
## Responses
158146

@@ -344,18 +332,26 @@ This library is typed for convenient access to the documented API. If you need t
344332

345333
### Undocumented request params
346334

347-
To make requests using undocumented parameters, you can provide or override parameters on the params object while building it.
335+
In [Example: creating a resource](#example-creating-a-resource) above, we used the `CustomerCreateParams.builder()` to pass to the `create` method of the `customers` service.
336+
337+
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:
348338

349339
```java
350-
FooCreateParams address = FooCreateParams.builder()
351-
.id("my_id")
352-
.putAdditionalProperty("secret_prop", JsonValue.from("hello"))
340+
import com.withorb.api.core.JsonValue;
341+
import com.withorb.api.models.CustomerCreateParams;
342+
343+
CustomerCreateParams params = CustomerCreateParams.builder()
344+
.putAdditionalHeader("Secret-Header", "42")
345+
.putAdditionalQueryParam("secret_query_param", "42")
346+
.putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))
353347
.build();
354348
```
355349

350+
You can also use the `putAdditionalProperty` method on nested headers, query params, or body objects.
351+
356352
### Undocumented response properties
357353

358-
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.
354+
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.
359355

360356
## Logging
361357

0 commit comments

Comments
 (0)