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
The SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.
279
279
280
+
### Parameters
281
+
282
+
To set undocumented parameters, a constructor exists that accepts dictionaries for additional header, query, and body values. If the method type doesn't support request bodies (e.g. `GET` requests), the constructor will only accept a header and query dictionary.
283
+
284
+
```csharp
285
+
usingSystem.Collections.Generic;
286
+
usingSystem.Text.Json;
287
+
usingOrb.Models.Customers;
288
+
289
+
CustomerCreateParamsparameters=new
290
+
(
291
+
rawHeaderData: new Dictionary<string, JsonElement>()
// In case of conflict, these parameters take precedence over the custom parameters.
309
+
AutoCollection=true
310
+
};
311
+
```
312
+
313
+
The raw parameters can also be accessed through the `RawHeaderData`, `RawQueryData`, and `RawBodyData` (if available) properties.
314
+
315
+
This can also be used to set a documented parameter to an undocumented or not yet supported _value_, as long as the parameter is optional. If the parameter is required, omitting its `init` property will result in a compile-time error. To work around this, the `FromRawUnchecked` method can be used:
Undocumented properties, or undocumented values of documented properties, on nested parameters can be set similarly, using a dictionary in the constructor of the nested parameter.
To access undocumented response properties, the `RawData` property can be used:
380
+
381
+
```csharp
382
+
usingSystem.Text.Json;
383
+
384
+
varresponse=client.Customers.Create(parameters)
385
+
if (response.RawData.TryGetValue("my_custom_key", outJsonElementvalue))
386
+
{
387
+
// Do something with `value`
388
+
}
389
+
```
390
+
391
+
`RawData` isa `IReadonlyDictionary<string, JsonElement>`. ItholdsthefulldatareceivedfromtheAPIserver.
392
+
280
393
### Response validation
281
394
282
395
Inrarecases, theAPImayreturnaresponsethatdoesn't match the expected type. For example, the SDK may expect a property to contain a `string`, but the API could return something else.
0 commit comments