withAdkHttpOptions function

Map<String, Object?> withAdkHttpOptions({
  1. Map<String, Object?>? clientKwargs,
  2. Map<String, String>? defaultHeaders,
  3. HttpRetryOptions? retryOptions,
  4. String? apiVersion,
  5. String? baseUrl,
  6. bool excludeRuntimeTag = false,
  7. Map<String, String>? environment,
})

Returns a copy of clientKwargs with ADK HTTP options and tracking headers merged into http_options.

Implementation

Map<String, Object?> withAdkHttpOptions({
  Map<String, Object?>? clientKwargs,
  Map<String, String>? defaultHeaders,
  HttpRetryOptions? retryOptions,
  String? apiVersion,
  String? baseUrl,
  bool excludeRuntimeTag = false,
  Map<String, String>? environment,
}) {
  final HttpOptions resolved = buildAdkHttpOptions(
    clientKwargs: clientKwargs,
    defaultHeaders: defaultHeaders,
    retryOptions: retryOptions,
    apiVersion: apiVersion,
    baseUrl: baseUrl,
    excludeRuntimeTag: excludeRuntimeTag,
    environment: environment,
  );
  final Map<String, Object?> mergedKwargs = <String, Object?>{...?clientKwargs};
  mergedKwargs.remove('httpOptions');
  mergedKwargs['http_options'] = resolved;
  return mergedKwargs;
}