### Complete Usage Example of OkHttpRequestAdapter Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/OkHttpRequestAdapter.md Demonstrates how to create and use the OkHttpRequestAdapter for making a GET request to retrieve user information. Includes setup for authentication, HTTP client, and request details. ```java import com.microsoft.kiota.authentication.AnonymousAuthenticationProvider; import com.microsoft.kiota.http.OkHttpRequestAdapter; import com.microsoft.kiota.http.KiotaClientFactory; import com.microsoft.kiota.serialization.json.JsonParseNodeFactory; import com.microsoft.kiota.serialization.json.JsonSerializationWriterFactory; import okhttp3.OkHttpClient; // Create authentication provider AuthenticationProvider authProvider = new AnonymousAuthenticationProvider(); // Create HTTP client with default middleware OkHttpClient.Builder builder = KiotaClientFactory.create(authProvider); OkHttpClient httpClient = builder.build(); // Create adapter OkHttpRequestAdapter adapter = new OkHttpRequestAdapter( authProvider, new JsonParseNodeFactory(), new JsonSerializationWriterFactory(), httpClient); adapter.setBaseUrl("https://api.example.com"); // Create request information HashMap pathParams = new HashMap<>(); pathParams.put("baseurl", adapter.getBaseUrl()); pathParams.put("userId", "user123"); RequestInformation requestInfo = new RequestInformation( HttpMethod.GET, "{+baseurl}/users/{userId}", pathParams); // Execute request try { User user = adapter.send( requestInfo, null, User::createFromDiscriminatorValue); System.out.println("User: " + user.getDisplayName()); } catch (ApiException ex) { System.out.println("Error: " + ex.getResponseStatusCode()); } ``` -------------------------------- ### Complete Kiota Java Client Configuration Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/configuration.md A full example of setting up a Kiota Java client, including authentication, middleware options, HTTP client, and request adapter. This setup is necessary before making API calls. ```java import com.microsoft.kiota.*; import com.microsoft.kiota.http.*; import com.microsoft.kiota.http.middleware.options.*; import com.microsoft.kiota.authentication.*; import com.microsoft.kiota.serialization.json.*; import com.azure.identity.DefaultAzureCredential; import okhttp3.OkHttpClient; import java.time.Duration; // 1. Setup authentication DefaultAzureCredential credential = new DefaultAzureCredential(); AuthenticationProvider authProvider = new AzureIdentityAuthenticationProvider( credential, new String[] { "graph.microsoft.com" }, "https://graph.microsoft.com/.default"); // 2. Configure middleware RetryHandlerOption retryOption = new RetryHandlerOption(); retryOption.setMaxRetry(5); retryOption.setDelay(Duration.ofMillis(100)); UserAgentHandlerOption userAgentOption = new UserAgentHandlerOption(); userAgentOption.setUserAgent("MyApp/1.0"); // 3. Create HTTP client OkHttpClient httpClient = KiotaClientFactory.create( authProvider, new RequestOption[] { retryOption, userAgentOption }) .connectTimeout(Duration.ofSeconds(30)) .readTimeout(Duration.ofSeconds(30)) .build(); // 4. Create request adapter OkHttpRequestAdapter adapter = new OkHttpRequestAdapter( authProvider, new JsonParseNodeFactory(), new JsonSerializationWriterFactory(), httpClient); adapter.setBaseUrl("https://graph.microsoft.com"); // 5. Register serializers/deserializers globally ApiClientBuilder.registerDefaultDeserializer( () -> new JsonParseNodeFactory()); ApiClientBuilder.registerDefaultSerializer( () -> new JsonSerializationWriterFactory()); // Now ready for API calls ``` -------------------------------- ### Making GET Requests with Path Parameters Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/INDEX.md Demonstrates how to construct a GET request with path parameters and execute it using the RequestAdapter. Includes basic error handling for API exceptions. ```java HashMap pathParams = new HashMap<>(); pathParams.put("baseurl", adapter.getBaseUrl()); pathParams.put("id", "123"); RequestInformation requestInfo = new RequestInformation( HttpMethod.GET, "{+baseurl}/users/{id}", pathParams); requestInfo.headers.add("Accept-Language", "en-US"); try { User user = adapter.send( requestInfo, null, User::createFromDiscriminatorValue); } catch (ApiException ex) { System.err.println("Error: " + ex.getResponseStatusCode()); } ``` -------------------------------- ### Usage Example for Context-Aware Authentication Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/AuthenticationProvider.md Demonstrates how to create and pass additional authentication context. This example shows adding a 'userId' to the context map, which can then be utilized by a context-aware authentication provider. ```java Map context = new HashMap<>(); context.put("userId", "user123"); // Pass context through request options or other means // depending on framework integration ``` -------------------------------- ### Configuration Guide Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/INDEX.md Guide on configuring various aspects of Kiota Java, including request adapters, HTTP client timeouts, middleware handlers, and authentication. ```APIDOC ## Configuration ### Description Details on configuring `RequestAdapter` options, `OkHttpClient` timeouts, middleware handler options (e.g., Retry, Redirect, UserAgent), serialization/deserialization setup, authentication, and backing store configuration. ### Contents - RequestAdapter options - OkHttpClient timeouts - Middleware handler options (Retry, Redirect, UserAgent, etc.) - Serialization/deserialization setup - Authentication configuration - Backing store configuration ``` -------------------------------- ### Basic Client Setup with OkHttp Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/INDEX.md Sets up an OkHttp-based HTTP client with an authentication provider and registers JSON serialization factories. This is the foundational step for making API calls. ```java AuthenticationProvider authProvider = new AnonymousAuthenticationProvider(); OkHttpClient httpClient = KiotaClientFactory.create(authProvider).build(); OkHttpRequestAdapter adapter = new OkHttpRequestAdapter( authProvider, new JsonParseNodeFactory(), new JsonSerializationWriterFactory(), httpClient); adapter.setBaseUrl("https://api.example.com"); ``` -------------------------------- ### Plain Text Serialization Example Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/SerializationWriter.md Example of using TextSerializationWriter to serialize data into plain text format. Produces a plain text string. ```java SerializationWriterFactory factory = new TextSerializationWriterFactory(); SerializationWriter writer = factory.getSerializationWriter("text/plain"); writer.writeStringValue(null, "Plain text content"); InputStream textContent = writer.getSerializedContent(); // Produces: Plain text content ``` -------------------------------- ### Format Registration Example Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/ARCHITECTURE.md Shows how serialization and deserialization factories are registered in Kiota's global registry for different content types. ```text SerializationWriterFactoryRegistry (singleton) ├── "application/json" → JsonSerializationWriterFactory ├── "text/plain" → TextSerializationWriterFactory ├── "application/x-www-form-urlencoded" → FormSerializationWriterFactory └── ... ParseNodeFactoryRegistry (singleton) ├── "application/json" → JsonParseNodeFactory ├── "text/plain" → TextParseNodeFactory ├── "application/x-www-form-urlencoded" → FormParseNodeFactory └── ... ``` -------------------------------- ### Example Usage of getUri Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/RequestInformation.md Demonstrates how to create a RequestInformation object, add query parameters, and then retrieve the expanded URI. The output URI will include the base URL, path, and any added query parameters. ```java RequestInformation requestInfo = new RequestInformation( HttpMethod.GET, "{+baseurl}/users/{userId}", pathParameters); requestInfo.addQueryParameter("filter", "active"); URI uri = requestInfo.getUri(); System.out.println(uri); // e.g., "https://api.example.com/users/123?filter=active" ``` -------------------------------- ### Parsable Model Serialization Example Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/SerializationWriter.md Demonstrates how a typical Parsable model class should implement the serialize method using SerializationWriter. ```java public class User implements Parsable { private String id; private String displayName; private String mail; private OffsetDateTime createdDateTime; private List proxyAddresses; @Override public void serialize(@Nonnull final SerializationWriter writer) { Objects.requireNonNull(writer); // Write primitive values writer.writeStringValue("id", this.id); writer.writeStringValue("displayName", this.displayName); writer.writeStringValue("mail", this.mail); writer.writeOffsetDateTimeValue("createdDateTime", this.createdDateTime); // Write collections writer.writeCollectionOfPrimitiveValues("proxyAddresses", this.proxyAddresses); // Write nested objects writer.writeObjectValue("profile", this.profile); // Write enum values writer.writeEnumValue("status", this.status); } } ``` -------------------------------- ### JSON Serialization Example Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/SerializationWriter.md Example of using JsonSerializationWriter to serialize data into JSON format. Produces a JSON string. ```java SerializationWriterFactory factory = new JsonSerializationWriterFactory(); SerializationWriter writer = factory.getSerializationWriter("application/json"); writer.writeStringValue("name", "Alice"); writer.writeIntegerValue("age", 25); writer.writeCollectionOfPrimitiveValues("tags", Arrays.asList("developer", "java")); InputStream jsonContent = writer.getSerializedContent(); // Produces: {"name":"Alice","age":25,"tags":["developer","java"]} ``` -------------------------------- ### User Model with Deserializers Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/Parsable.md Example of a User class implementing Parsable, defining how its properties are deserialized from a source. ```java public class User implements Parsable { private String id; private String displayName; private String mail; @Override public Map> getFieldDeserializers() { Map> deserializers = new HashMap<>(); deserializers.put("id", n -> setId(n.getStringValue())); deserializers.put("displayName", n -> setDisplayName(n.getStringValue())); deserializers.put("mail", n -> setMail(n.getStringValue())); return deserializers; } // getters and setters... } ``` -------------------------------- ### Generated UsersRequestBuilder Example Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/ARCHITECTURE.md Example of a generated RequestBuilder class extending BaseRequestBuilder. It provides a fluent API for building requests, such as retrieving user data by ID. ```java // Generated pattern public class UsersRequestBuilder extends BaseRequestBuilder { public UsersRequestBuilder( RequestAdapter adapter, String urlTemplate, Map pathParameters) { super(adapter, urlTemplate, pathParameters); } public UserItemRequestBuilder byUserId(String userId) { Map newParams = new HashMap<>(pathParameters); newParams.put("userId", userId); return new UserItemRequestBuilder( requestAdapter, urlTemplate + "/{userId}", newParams); } public T get(Consumer requestConfig) { RequestInformation requestInfo = new RequestInformation( HttpMethod.GET, urlTemplate, pathParameters); requestInfo.configure(requestConfig, GetRequestConfiguration::new); return requestAdapter.send( requestInfo, null, ResponseType::createFromDiscriminatorValue); } } ``` -------------------------------- ### User Model Serialization Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/Parsable.md Example of a User class implementing Parsable, defining how its properties are serialized to a writer. ```java @Override public void serialize(@Nonnull final SerializationWriter writer) { Objects.requireNonNull(writer); writer.writeStringValue("id", this.id); writer.writeStringValue("displayName", this.displayName); writer.writeStringValue("mail", this.mail); // Write additional properties } ``` -------------------------------- ### MultipartBody Serialization Example Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/MultipartBody.md Demonstrates how to construct a multipart request body with text and file parts, set it on a RequestInformation object, and send it using a RequestAdapter. Ensure to close the file stream after use. ```java import com.microsoft.kiota.RequestAdapter; import com.microsoft.kiota.RequestInformation; import com.microsoft.kiota.HttpMethod; import com.microsoft.kiota.MultipartBody; import java.io.FileInputStream; import java.util.HashMap; // Create multipart body MultipartBody body = new MultipartBody(); // Add text fields body.addOrReplacePart("title", "text/plain", "Document Upload"); body.addOrReplacePart("description", "text/plain", "My important document"); // Add file FileInputStream fileStream = new FileInputStream("document.pdf"); body.addOrReplacePart( "file", "application/pdf", fileStream, "document.pdf"); // Create request HashMap pathParams = new HashMap<>(); pathParams.put("baseurl", "https://api.example.com"); RequestInformation requestInfo = new RequestInformation( HttpMethod.POST, "{+baseurl}/documents/upload", pathParams); // Set multipart body (requestAdapter set automatically) requestInfo.setContentFromParsable(adapter, "multipart/form-data", body); // Send request try { UploadResponse response = adapter.send( requestInfo, null, UploadResponse::createFromDiscriminatorValue); System.out.println("Upload successful: " + response.getId()); } catch (ApiException ex) { System.out.println("Upload failed: " + ex.getResponseStatusCode()); } finally { fileStream.close(); } ``` -------------------------------- ### User Model Implementation with ParseNode Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Example of a User model implementing Parsable, demonstrating how to use ParseNode methods within getFieldDeserializers to deserialize various data types. ```java public class User implements Parsable { private String id; private String displayName; private String mail; private OffsetDateTime createdDateTime; private List proxyAddresses; private Status status; private Address address; @Override public Map> getFieldDeserializers() { Map> deserializers = new HashMap<>(); // Primitive values deserializers.put("id", n -> setId(n.getStringValue())); deserializers.put("displayName", n -> setDisplayName(n.getStringValue())); deserializers.put("mail", n -> setMail(n.getStringValue())); // Date/time values deserializers.put("createdDateTime", n -> setCreatedDateTime(n.getOffsetDateTimeValue())); // Collections deserializers.put("proxyAddresses", n -> setProxyAddresses( n.getCollectionOfPrimitiveValues(String.class))); // Enum values deserializers.put("status", n -> setStatus(n.getEnumValue(Status::forValue))); // Nested objects deserializers.put("address", n -> setAddress( n.getObjectValue(Address::createFromDiscriminatorValue))); return deserializers; } // Getters and setters... } ``` -------------------------------- ### Example Usage of addQueryParameter Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/RequestInformation.md Shows how to add multiple query parameters to a RequestInformation object. This includes adding string, integer, and zero values. ```java requestInfo.addQueryParameter("filter", "active"); requestInfo.addQueryParameter("limit", 10); requestInfo.addQueryParameter("offset", 0); ``` -------------------------------- ### Complete ApiException Handling Example Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ApiException.md Demonstrates how to send a request, define custom error mappings for specific HTTP status codes, and handle ApiException by inspecting status codes, headers, and messages. This is useful for robustly managing API responses and errors. ```java RequestAdapter adapter = /* ... */; RequestInformation requestInfo = new RequestInformation( HttpMethod.GET, "{+baseurl}/users/{userId}", pathParameters); HashMap> errorMappings = new HashMap<>(); errorMappings.put("404", NotFoundError::createFromDiscriminatorValue); errorMappings.put("500", ServerError::createFromDiscriminatorValue); errorMappings.put("4XX", ClientError::createFromDiscriminatorValue); errorMappings.put("5XX", ServerError::createFromDiscriminatorValue); try { User user = adapter.send( requestInfo, errorMappings, User::createFromDiscriminatorValue); } catch (ApiException ex) { int statusCode = ex.getResponseStatusCode(); ResponseHeaders headers = ex.getResponseHeaders(); String contentType = headers.getValue("Content-Type"); System.out.println("API Error: " + statusCode); System.out.println("Headers: " + headers); System.out.println("Message: " + ex.getMessage()); // Handle specific status codes if (statusCode == 404) { System.out.println("User not found"); } else if (statusCode == 401) { System.out.println("Authentication required"); } else if (statusCode >= 500) { System.out.println("Server error - retry recommended"); } } ``` -------------------------------- ### Typical Parsable Implementation Pattern Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/Parsable.md A comprehensive example of a User model implementing the Parsable interface, including a factory method, deserializers for various data types, and serialization logic. ```java public class User implements Parsable { private String id; private String displayName; private String mail; private LocalDateTime createdDateTime; private List proxyAddresses; // Factory method for deserialization public static User createFromDiscriminatorValue(ParseNode parseNode) { Objects.requireNonNull(parseNode); return new User(); } @Override public Map> getFieldDeserializers() { Map> deserializers = new HashMap<>(); deserializers.put("id", n -> setId(n.getStringValue())); deserializers.put("displayName", n -> setDisplayName(n.getStringValue())); deserializers.put("mail", n -> setMail(n.getStringValue())); deserializers.put("createdDateTime", n -> setCreatedDateTime(n.getOffsetDateTimeValue())); deserializers.put("proxyAddresses", n -> setProxyAddresses( n.getCollectionOfPrimitiveValues(String.class))); return deserializers; } @Override public void serialize(@Nonnull final SerializationWriter writer) { Objects.requireNonNull(writer); writer.writeStringValue("id", this.id); writer.writeStringValue("displayName", this.displayName); writer.writeStringValue("mail", this.mail); writer.writeOffsetDateTimeValue("createdDateTime", this.createdDateTime); writer.writeCollectionOfPrimitiveValues("proxyAddresses", this.proxyAddresses); } // Getters and setters... } ``` -------------------------------- ### Create OkHttpClient Builder with Default Configuration Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/KiotaClientFactory.md Use this method to get a default OkHttpClient.Builder with standard Kiota middleware pre-configured. The builder can then be used to construct an OkHttpClient instance. ```java OkHttpClient.Builder builder = KiotaClientFactory.create(); OkHttpClient client = builder.build(); ``` -------------------------------- ### Form Serialization Example Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/SerializationWriter.md Demonstrates how to use FormSerializationWriter to serialize key-value pairs into form-encoded format. Obtain the writer from a FormSerializationWriterFactory and use write methods to add data. The serialized content can then be retrieved as an InputStream. ```java SerializationWriterFactory factory = new FormSerializationWriterFactory(); SerializationWriter writer = factory.getSerializationWriter("application/x-www-form-urlencoded"); writer.writeStringValue("username", "alice"); writer.writeStringValue("password", "secret123"); InputStream formContent = writer.getSerializedContent(); // Produces: username=alice&password=secret123 ``` -------------------------------- ### Configure OkHttpClient Timeouts Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/configuration.md Customize connection, read, and call timeouts for the OkHttpClient used by Kiota. This example shows setting custom durations for each timeout. ```java OkHttpClient client = new OkHttpClient.Builder() .connectTimeout(Duration.ofSeconds(30)) .readTimeout(Duration.ofSeconds(60)) .callTimeout(Duration.ofSeconds(120)) .build(); OkHttpRequestAdapter adapter = new OkHttpRequestAdapter( authProvider, null, null, client); ``` -------------------------------- ### Extending BaseRequestBuilder for Users API Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/BaseRequestBuilder.md This example shows how a generated request builder, UsersRequestBuilder, extends BaseRequestBuilder. It includes a constructor and methods to build URLs for specific user items and to construct GET requests. ```java public class UsersRequestBuilder extends BaseRequestBuilder { public UsersRequestBuilder( @Nonnull final RequestAdapter requestAdapter, @Nonnull final String urlTemplate, @Nonnull final HashMap pathParameters) { super(requestAdapter, urlTemplate, pathParameters); } public UserItemRequestBuilder byUserId(@Nonnull final String userId) { HashMap newParams = new HashMap<>(this.pathParameters); newParams.put("userId", userId); return new UserItemRequestBuilder( this.requestAdapter, this.urlTemplate + "/{userId}", newParams); } public GetRequestInformation buildGetRequest( @Nullable final java.util.function.Consumer requestConfiguration) { RequestInformation requestInfo = new RequestInformation( HttpMethod.GET, this.urlTemplate, this.pathParameters); requestInfo.configure(requestConfiguration, GetRequestConfiguration::new); return requestInfo; } public GetAsync get(@Nullable final java.util.function.Consumer requestConfiguration) { RequestInformation requestInfo = buildGetRequest(requestConfiguration); return requestAdapter.send(requestInfo, errorMappings, UsersResponse::createFromDiscriminatorValue); } } ``` -------------------------------- ### create() Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/KiotaClientFactory.md Creates an OkHttpClient Builder with the default configuration and middleware. ```APIDOC ## create() ### Description Creates an OkHttpClient Builder with the default configuration and middleware. ### Method static ### Return Type `OkHttpClient.Builder` - An OkHttpClient Builder with default interceptors ### Example ```java OkHttpClient.Builder builder = KiotaClientFactory.create(); OkHttpClient client = builder.build(); ``` ``` -------------------------------- ### Multipart Body RFC 2388 Format Example Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/MultipartBody.md Illustrates the RFC 2388 compliant format produced when a MultipartBody is serialized, showing the boundary, content type, and disposition for each part. ```text --8a3f2b5c9e1d4f6a Content-Type: text/plain Content-Disposition: form-data; name="title" Document Upload --8a3f2b5c9e1d4f6a Content-Type: application/pdf Content-Disposition: form-data; name="file"; filename="document.pdf" [binary PDF content] --8a3f2b5c9e1d4f6a-- ``` -------------------------------- ### create(BaseBearerTokenAuthenticationProvider) Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/KiotaClientFactory.md Creates an OkHttpClient Builder with default middleware including AuthorizationHandler. ```APIDOC ## create(BaseBearerTokenAuthenticationProvider) ### Description Creates an OkHttpClient Builder with default middleware including AuthorizationHandler. ### Method static ### Parameters #### Path Parameters - **authenticationProvider** (BaseBearerTokenAuthenticationProvider) - Required - Authentication provider to use for the AuthorizationHandler ### Return Type `OkHttpClient.Builder` - An OkHttpClient Builder with authorization middleware ### Throws `NullPointerException` - If authenticationProvider is null ### Example ```java AuthenticationProvider authProvider = /* ... */; OkHttpClient.Builder builder = KiotaClientFactory.create(authProvider); OkHttpClient client = builder.build(); ``` ``` -------------------------------- ### JSON Deserialization Flow Example Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Demonstrates how a ParseNode is used to deserialize a JSON response body into an object. This process involves obtaining the root ParseNode, retrieving field deserializers, and using child nodes to accept values. ```java // Response: { "id": "123", "name": "Alice", "status": "active" } ParseNode rootNode = parseNodeFactory.getParseNode("application/json", responseBody); Map> deserializers = user.getFieldDeserializers(); deserializers.get("id").accept(rootNode.getChildNode("id")); // Gets "123" deserializers.get("name").accept(rootNode.getChildNode("name")); // Gets "Alice" deserializers.get("status").accept(rootNode.getChildNode("status")); // Gets Status.ACTIVE ``` -------------------------------- ### getRequestOptions Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/RequestInformation.md Gets the request options for this request. Options are unique by their type. ```APIDOC ## getRequestOptions ### Description Gets the request options for this request. Options are unique by type. ### Method GET (Implicit) ### Endpoint N/A (Method of a Java class) ### Parameters None ### Return Type Collection - The collection of request options ``` -------------------------------- ### create(RequestOption[]) Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/KiotaClientFactory.md Creates an OkHttpClient Builder with default configuration and custom middleware options. ```APIDOC ## create(RequestOption[]) ### Description Creates an OkHttpClient Builder with default configuration and custom middleware options. ### Method static ### Parameters #### Path Parameters - **requestOptions** (RequestOption[]) - Required - Configuration options for the interceptors ### Return Type `OkHttpClient.Builder` - An OkHttpClient Builder with configured interceptors ### Throws `NullPointerException` - If requestOptions is null ### Example ```java RetryHandlerOption retryOption = new RetryHandlerOption(); retryOption.setMaxRetry(3); retryOption.setDelay(Duration.ofSeconds(1)); OkHttpClient.Builder builder = KiotaClientFactory.create(new RequestOption[] { retryOption }); OkHttpClient client = builder.build(); ``` ``` -------------------------------- ### getBaseUrl Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/RequestAdapter.md Gets the base URL for every request made using this adapter. ```APIDOC ## getBaseUrl ### Description Gets the base URL for every request. ### Method GET (Implicit) ### Endpoint N/A (Method on an object) ### Parameters None ### Return Type String - The base URL for every request ### Example ```java String baseUrl = adapter.getBaseUrl(); System.out.println(baseUrl); // e.g., "https://api.example.com" ``` ``` -------------------------------- ### Construct OkHttpRequestAdapter with Options Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/configuration.md Instantiate OkHttpRequestAdapter with custom authentication, parsing, serialization, HTTP client, and observability settings. ```java OkHttpRequestAdapter adapter = new OkHttpRequestAdapter( authenticationProvider, new JsonParseNodeFactory(), new JsonSerializationWriterFactory(), okHttpClient, observabilityOptions); ``` -------------------------------- ### Configure OkHttpRequestAdapter Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/ARCHITECTURE.md Initializes and configures the OkHttpRequestAdapter with various dependencies, including the HTTP client. This sets up the adapter for communication. ```java OkHttpRequestAdapter adapter = new OkHttpRequestAdapter( authProvider, parseNodeFactory, serializationWriterFactory, httpClient, observabilityOptions); adapter.setBaseUrl("https://api.example.com"); ``` -------------------------------- ### Get Query Parameters Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/RequestInformation.md Retrieves a copy of the query parameters currently set for the request. ```java @Nonnull public Map getQueryParameters() ``` -------------------------------- ### getSerializationWriterFactory Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/RequestAdapter.md Gets the serialization writer factory currently in use for the HTTP core service. ```APIDOC ## getSerializationWriterFactory ### Description Gets the serialization writer factory currently in use for the HTTP core service. ### Method SerializationWriterFactory ### Endpoint None ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters #### — - **—** (—) - — - — - — ### Return Type `SerializationWriterFactory` - The serialization writer factory currently in use ### Throws None ### Example ```java RequestAdapter adapter = /* ... */; SerializationWriterFactory factory = adapter.getSerializationWriterFactory(); String validContentType = factory.getValidContentType(); ``` ``` -------------------------------- ### Instantiate OkHttpRequestAdapter with AuthenticationProvider, ParseNodeFactory, and SerializationWriterFactory Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/OkHttpRequestAdapter.md Instantiates a new OkHttp request adapter with authentication provider, parse node factory, and serialization writer factory. Uses registry default if parseNodeFactory or serializationWriterFactory are null. ```java OkHttpRequestAdapter adapter = new OkHttpRequestAdapter( authProvider, new JsonParseNodeFactory(), new JsonSerializationWriterFactory()); ``` -------------------------------- ### getSerializedContent Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/SerializationWriter.md Gets the serialized content as an InputStream. This method must be called after all write operations have been completed. ```APIDOC ## getSerializedContent ### Description Gets the serialized content as an InputStream. Must be called after all write operations. ### Method Signature `@Nonnull InputStream getSerializedContent()` ### Return Type `InputStream` - The serialized content as a stream ### Example ```java try (SerializationWriter writer = factory.getSerializationWriter("application/json")) { writer.writeStringValue("name", "John"); writer.writeIntegerValue("age", 30); InputStream content = writer.getSerializedContent(); // Use content in request body } ``` ``` -------------------------------- ### create(BaseBearerTokenAuthenticationProvider, RequestOption[]) Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/KiotaClientFactory.md Creates an OkHttpClient Builder pre-configured with a bearer token authentication provider and custom middleware options. This allows for secure and customized API client creation. ```APIDOC ## create(BaseBearerTokenAuthenticationProvider, RequestOption[]) ### Description Creates an OkHttpClient Builder with authorization handler and custom middleware options. ### Method ```java public static OkHttpClient.Builder create( @Nonnull final BaseBearerTokenAuthenticationProvider authenticationProvider, @Nonnull final RequestOption[] requestOptions) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **authenticationProvider** (BaseBearerTokenAuthenticationProvider) - Required - Authentication provider for the AuthorizationHandler - **requestOptions** (RequestOption[]) - Required - Configuration options for the interceptors ### Return Type `OkHttpClient.Builder` - An OkHttpClient Builder with authorization and configured middleware ### Throws `NullPointerException` - If any parameter is null ### Example ```java RetryHandlerOption retryOption = new RetryHandlerOption(); retryOption.setMaxRetry(5); OkHttpClient.Builder builder = KiotaClientFactory.create( authProvider, new RequestOption[] { retryOption }); OkHttpClient client = builder.build(); ``` ``` -------------------------------- ### Instantiate OkHttpRequestAdapter with AuthenticationProvider and ParseNodeFactory Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/OkHttpRequestAdapter.md Instantiates a new OkHttp request adapter with authentication provider and parse node factory. Uses registry default if parseNodeFactory is null. ```java ParseNodeFactory parseFactory = new JsonParseNodeFactory(); OkHttpRequestAdapter adapter = new OkHttpRequestAdapter(authProvider, parseFactory); ``` -------------------------------- ### OkHttpRequestAdapter Constructor Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/OkHttpRequestAdapter.md Instantiates a new OkHttp request adapter with all components including observability options. ```APIDOC ## OkHttpRequestAdapter Constructor ### Description Instantiates a new OkHttp request adapter with all components including observability options. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Constructor Signature ```java public OkHttpRequestAdapter( @Nonnull final AuthenticationProvider authenticationProvider, @Nullable final ParseNodeFactory parseNodeFactory, @Nullable final SerializationWriterFactory serializationWriterFactory, @Nullable final Call.Factory client, @Nullable final ObservabilityOptions observabilityOptions) ``` ### Parameter Details - **authenticationProvider** (AuthenticationProvider) - Required - The authentication provider - **parseNodeFactory** (ParseNodeFactory) - Optional - The parse node factory - **serializationWriterFactory** (SerializationWriterFactory) - Optional - The serialization writer factory - **client** (Call.Factory) - Optional - The OkHttp client factory - **observabilityOptions** (ObservabilityOptions) - Optional - Observability/tracing options (OpenTelemetry) ``` -------------------------------- ### getUntypedNodeValue Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Gets the untyped node value for schema-less data. Returns an UntypedNode that can represent any JSON value. ```APIDOC ## getUntypedNodeValue ### Description Gets the untyped node value for schema-less data. Returns an UntypedNode that can represent any JSON value. ### Method Signature ```java @Nullable UntypedNode getUntypedNodeValue() ``` ### Parameters None ### Return Type `UntypedNode` - The untyped value, or null ``` -------------------------------- ### Get Request Options Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/RequestInformation.md Retrieves the collection of request options associated with this request. Options are unique by their type. ```java @Nonnull public Collection getRequestOptions() ``` -------------------------------- ### Instantiate OkHttpRequestAdapter with all components including custom HTTP client Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/OkHttpRequestAdapter.md Instantiates a new OkHttp request adapter with all components including a custom HTTP client. Creates a default OkHttp client if the provided client is null. ```java OkHttpClient okHttpClient = new OkHttpClient.Builder() .connectTimeout(Duration.ofSeconds(30)) .readTimeout(Duration.ofSeconds(30)) .build(); OkHttpRequestAdapter adapter = new OkHttpRequestAdapter( authProvider, parseNodeFactory, serializationWriterFactory, okHttpClient); ``` -------------------------------- ### Get Serialized Content Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/SerializationWriter.md Retrieves the serialized content as an InputStream. This method must be called after all write operations are completed. ```java @Nonnull InputStream getSerializedContent() ``` ```java try (SerializationWriter writer = factory.getSerializationWriter("application/json")) { writer.writeStringValue("name", "John"); writer.writeIntegerValue("age", 30); InputStream content = writer.getSerializedContent(); // Use content in request body } ``` -------------------------------- ### getCollectionOfPrimitiveValues Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Gets a collection of primitive values from the node. This is useful for deserializing arrays of strings, integers, booleans, etc. ```APIDOC ## getCollectionOfPrimitiveValues ### Description Gets a collection of primitive values from the node. ### Method Signature ```java @Nullable List getCollectionOfPrimitiveValues(@Nonnull final Class targetClass) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters Table | Parameter | Type | Required | Default | Description | |---|---|---|---|---| | targetClass | Class | Yes | — | The primitive type of items in the collection | ### Type Parameters - `T` - Primitive type (String, Integer, Boolean, etc.) ### Return Type `List` - A list of primitive values, or null ### Throws `NullPointerException` - If targetClass is null ### Example ```java ParseNode node = /* ... */; List tags = node.getCollectionOfPrimitiveValues(String.class); List ids = node.getCollectionOfPrimitiveValues(Integer.class); ``` ``` -------------------------------- ### Configure KiotaClientFactory with Middleware and Authentication Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/KiotaClientFactory.md Demonstrates setting up Azure identity authentication and configuring retry, user agent, and redirect middleware options for the OkHttpClient. This is useful for customizing network request behavior in Kiota applications. ```java import com.microsoft.kiota.http.KiotaClientFactory; import com.microsoft.kiota.http.OkHttpRequestAdapter; import com.microsoft.kiota.http.middleware.options.*; import com.microsoft.kiota.authentication.AzureIdentityAuthenticationProvider; import com.azure.identity.DefaultAzureCredential; import okhttp3.OkHttpClient; import java.time.Duration; // Setup Azure authentication TokenCredential credential = new DefaultAzureCredential(); String[] allowedHosts = { "api.example.com" }; String[] scopes = { "https://api.example.com/.default" }; AuthenticationProvider authProvider = new AzureIdentityAuthenticationProvider( credential, allowedHosts, scopes); // Configure middleware options RetryHandlerOption retryOption = new RetryHandlerOption(); retryOption.setMaxRetry(5); retryOption.setDelay(Duration.ofMillis(100)); retryOption.setMaxDelay(Duration.ofSeconds(120)); UserAgentHandlerOption userAgentOption = new UserAgentHandlerOption(); userAgentOption.setUserAgent("MyApp/1.0 (compatible)"); RedirectHandlerOption redirectOption = new RedirectHandlerOption(); redirectOption.setMaxRedirects(10); // Create and configure HTTP client OkHttpClient httpClient = KiotaClientFactory.create( authProvider, new RequestOption[] { retryOption, userAgentOption, redirectOption }).build(); // Create request adapter OkHttpRequestAdapter adapter = new OkHttpRequestAdapter( authProvider, null, // Use default ParseNodeFactory null, // Use default SerializationWriterFactory httpClient); adapter.setBaseUrl("https://api.example.com"); // Now ready to use generated client code ``` -------------------------------- ### getObjectValue Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Gets the object value of the node. This method creates a Parsable object and calls its deserializers to populate the object. ```APIDOC ## getObjectValue ### Description Gets the object value of the node. Creates a Parsable object and calls its deserializers. ### Method Signature ```java @Nullable T getObjectValue( @Nonnull final ParsableFactory factory) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters Table | Parameter | Type | Required | Default | Description | |---|---|---|---|---| | factory | ParsableFactory | Yes | — | Factory to create the parsable object | ### Type Parameters - `T extends Parsable` - The type of the object ### Return Type `T` - The deserialized object, or null ### Throws `NullPointerException` - If factory is null ### Example ```java ParseNode node = /* ... */; User user = node.getObjectValue(User::createFromDiscriminatorValue); ``` ``` -------------------------------- ### Add and Remove Request Options Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/configuration.md Demonstrates how to add custom request options and remove them from a request. Also shows how to set a custom response handler. ```java // Add custom request options MyCustomOption customOption = new MyCustomOption(); requestInfo.addRequestOptions(Arrays.asList(customOption)); // Remove options requestInfo.removeRequestOptions(customOption); // Set response handler ResponseHandler responseHandler = new MyResponseHandler(); requestInfo.setResponseHandler(responseHandler); ``` -------------------------------- ### Create OkHttpClient Builder with Authentication and Options Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/KiotaClientFactory.md Creates an OkHttpClient Builder pre-configured with an authentication provider and custom request options. Use this when you need to specify both authentication and middleware configurations. ```java OkHttpClient.Builder builder = KiotaClientFactory.create( authProvider, new RequestOption[] { retryOption }); OkHttpClient client = builder.build(); ``` -------------------------------- ### Get Base URL Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/RequestAdapter.md Retrieves the base URL configured for all requests made through this adapter. This is useful for logging or debugging. ```java String baseUrl = adapter.getBaseUrl(); System.out.println(baseUrl); // e.g., "https://api.example.com" ``` -------------------------------- ### Create HTTP Client with Options Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/ARCHITECTURE.md Builds a custom HTTP client with specified request options and timeouts. This is part of the client configuration layer. ```java // HTTP client settings OkHttpClient httpClient = KiotaClientFactory.create( authProvider, new RequestOption[] { retryOption, userAgentOption }) .connectTimeout(Duration.ofSeconds(30)) .readTimeout(Duration.ofSeconds(30)) .build(); ``` -------------------------------- ### getCollectionOfEnumValues Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Gets a collection of enum values from the node. This method deserializes arrays of enum constants based on the provided parser. ```APIDOC ## getCollectionOfEnumValues ### Description Gets a collection of enum values from the node. ### Method Signature ```java @Nullable > List getCollectionOfEnumValues( @Nonnull final ValuedEnumParser enumParser) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters Table | Parameter | Type | Required | Default | Description | |---|---|---|---|---| | enumParser | ValuedEnumParser | Yes | — | Parser from string to enum instances | ### Type Parameters - `T extends Enum` - The enum type ### Return Type `List` - A list of enum values, or null ### Throws `NullPointerException` - If enumParser is null ``` -------------------------------- ### HTTP Client and Middleware Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/INDEX.md Implementations for HTTP communication using OkHttp and factory for configuring HTTP clients with middleware support. ```APIDOC ## OkHttpRequestAdapter ### Description An implementation of `RequestAdapter` that uses OkHttp for HTTP communication and supports a full middleware pipeline. ### Key Classes - `OkHttpRequestAdapter` ``` ```APIDOC ## KiotaClientFactory ### Description Factory for configuring and building HTTP clients, including the creation of various middleware handlers like retry, redirect, and authentication. ### Key Classes - `KiotaClientFactory` ``` -------------------------------- ### getQueryParameters Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/RequestInformation.md Gets a copy of the query parameters for the request. Returns a map where keys are parameter names and values are parameter values. ```APIDOC ## getQueryParameters ### Description Gets a copy of the query parameters for the request. ### Method GET (Implicit) ### Endpoint N/A (Method of a Java class) ### Parameters None ### Return Type Map - A clone of the query parameters ``` -------------------------------- ### Enable Backing Store Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/RequestAdapter.md Enables backing store proxies for serialization and parsing. Use this to track model changes. ```java RequestAdapter requestAdapter = /* ... */; BackingStoreFactory factory = BackingStoreFactorySingleton.getInstance(); requestAdapter.enableBackingStore(factory); ``` -------------------------------- ### getUri Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/RequestInformation.md Gets the URI of the request after expanding the URL template with path and query parameters. This method can throw URISyntaxException or IllegalStateException. ```APIDOC ## getUri ### Description Gets the URI of the request after expanding the URL template with path and query parameters. ### Method GET (Implicit) ### Endpoint N/A (Method of a Java class) ### Parameters None ### Return Type URI - The expanded URI ### Throws - `URISyntaxException` - When the URI template is invalid - `IllegalStateException` - When the baseurl parameter is missing from path parameters but required by the template ### Example ```java RequestInformation requestInfo = new RequestInformation( HttpMethod.GET, "{+baseurl}/users/{userId}", pathParameters); requestInfo.addQueryParameter("filter", "active"); URI uri = requestInfo.getUri(); System.out.println(uri); // e.g., "https://api.example.com/users/123?filter=active" ``` ``` -------------------------------- ### Configure RequestInformation Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/ARCHITECTURE.md Sets up request details such as HTTP method, URL, and path parameters. Allows for custom headers and query parameters via configuration. ```java RequestInformation requestInfo = new RequestInformation( HttpMethod.GET, "{+baseurl}/users", pathParameters); requestInfo.configure( config -> config.headers.add("X-Custom", "value"), RequestConfig::new, RequestConfig::getQueryParameters); ``` -------------------------------- ### getCollectionOfObjectValues Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Gets a collection of object values from the node. This method is used to deserialize arrays of complex objects that implement the Parsable interface. ```APIDOC ## getCollectionOfObjectValues ### Description Gets a collection of object values from the node. ### Method Signature ```java @Nullable List getCollectionOfObjectValues( @Nonnull final ParsableFactory factory) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters Table | Parameter | Type | Required | Default | Description | |---|---|---|---|---| | factory | ParsableFactory | Yes | — | Factory to create Parsable objects | ### Type Parameters - `T extends Parsable` - The object type ### Return Type `List` - A list of deserialized objects, or null ### Throws `NullPointerException` - If factory is null ### Example ```java ParseNode node = /* ... */; List users = node.getCollectionOfObjectValues(User::createFromDiscriminatorValue); ``` ``` -------------------------------- ### create(List) Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/KiotaClientFactory.md Creates an OkHttpClient Builder with custom interceptors provided as a List. ```APIDOC ## create(List) ### Description Creates an OkHttpClient Builder with custom interceptors provided as a List. ### Method static ### Parameters #### Path Parameters - **interceptors** (List) - Required - The interceptors to add to the client ### Return Type `OkHttpClient.Builder` - An OkHttpClient Builder with specified interceptors ### Throws `NullPointerException` - If interceptors is null ``` -------------------------------- ### RequestAdapter Methods Implemented by OkHttpRequestAdapter Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/OkHttpRequestAdapter.md OkHttpRequestAdapter implements all methods from the RequestAdapter interface. Refer to the RequestAdapter documentation for complete details on each method. ```APIDOC ## Methods from RequestAdapter Interface ### Description OkHttpRequestAdapter implements all methods from the RequestAdapter interface. Refer to the [RequestAdapter](RequestAdapter.md) documentation for complete details on each method. ### Implemented Methods - `enableBackingStore(BackingStoreFactory)` - `getSerializationWriterFactory(): SerializationWriterFactory` - `send(...): ModelType` - `sendCollection(...): List` - `sendPrimitive(...): ModelType` - `sendPrimitiveCollection(...): List` - `sendEnum(...): > ModelType` - `sendEnumCollection(...): > List` - `setBaseUrl(String baseUrl): void` - `getBaseUrl(): String` - `convertToNativeRequest(RequestInformation): T` ``` -------------------------------- ### Get UUID Value from ParseNode Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Retrieves the UUID representation of the node's value. Returns null if the node does not contain a UUID value. ```java @Nullable UUID getUUIDValue() ``` -------------------------------- ### Get Float Value from ParseNode Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Retrieves the float representation of the node's value. Returns null if the node does not contain a float value. ```java @Nullable Float getFloatValue() ``` -------------------------------- ### Get Integer Value from ParseNode Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Retrieves the integer representation of the node's value. Returns null if the node does not contain an integer value. ```java @Nullable Integer getIntegerValue() ``` -------------------------------- ### Instantiate OkHttpRequestAdapter with AuthenticationProvider Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/OkHttpRequestAdapter.md Instantiates a new OkHttp request adapter with the provided authentication provider. Uses default ParseNodeFactory and SerializationWriterFactory registries. Throws NullPointerException if authenticationProvider is null. ```java AuthenticationProvider authProvider = new AnonymousAuthenticationProvider(); OkHttpRequestAdapter adapter = new OkHttpRequestAdapter(authProvider); adapter.setBaseUrl("https://api.example.com"); ``` -------------------------------- ### Get BigDecimal Value from ParseNode Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Retrieves the BigDecimal representation of the node's value. Returns null if the node does not contain a BigDecimal value. ```java @Nullable BigDecimal getBigDecimalValue() ``` -------------------------------- ### Get Byte Value from ParseNode Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Retrieves the byte representation of the node's value. Returns null if the node does not contain a byte value. ```java @Nullable Byte getByteValue() ``` -------------------------------- ### Create OkHttpClient Builder with Request Options Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/KiotaClientFactory.md Use this method to create an OkHttpClient.Builder with default middleware and custom request options, such as retry policies. This allows for fine-grained control over client behavior. ```java RetryHandlerOption retryOption = new RetryHandlerOption(); retryOption.setMaxRetry(3); retryOption.setDelay(Duration.ofSeconds(1)); OkHttpClient.Builder builder = KiotaClientFactory.create(new RequestOption[] { retryOption }); OkHttpClient client = builder.build(); ``` -------------------------------- ### Get Boolean Value from ParseNode Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Retrieves the boolean representation of the node's value. Returns null if the node does not contain a boolean value. ```java @Nullable Boolean getBooleanValue() ``` -------------------------------- ### OkHttpRequestAdapter Constructor Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/OkHttpRequestAdapter.md Instantiates a new OkHttp request adapter with all components including observability options. ```java public OkHttpRequestAdapter( @Nonnull final AuthenticationProvider authenticationProvider, @Nullable final ParseNodeFactory parseNodeFactory, @Nullable final SerializationWriterFactory serializationWriterFactory, @Nullable final Call.Factory client, @Nullable final ObservabilityOptions observabilityOptions) ``` -------------------------------- ### Get String Value from ParseNode Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/ParseNode.md Retrieves the string representation of the node's value. Returns null if the node does not contain a string value. ```java @Nullable String getStringValue() ``` -------------------------------- ### Get Serialization Writer Factory Source: https://github.com/microsoft/kiota-java/blob/main/_autodocs/api-reference/RequestAdapter.md Retrieves the serialization writer factory used by the HTTP core service. This factory determines how objects are serialized. ```java RequestAdapter adapter = /* ... */; SerializationWriterFactory factory = adapter.getSerializationWriterFactory(); String validContentType = factory.getValidContentType(); ```