$getImage_Request method

  1. @experimental
Request $getImage_Request({
  1. required String key,
  2. ThemingGetImageUseSvg? useSvg,
})

Get an image.

Returns a DynamiteRequest backing the getImage operation. Throws a DynamiteApiException if the API call does not return an expected status code.

Parameters:

  • useSvg Return image as SVG. Defaults to 1.
  • key Key of the image.

Status codes:

  • 200: Image returned
  • 404: Image not found
  • 500

See:

  • getImage for a method executing this request and parsing the response.
  • $getImage_Serializer for a converter to parse the Response from an executed this request.

Implementation

@_i2.experimental
_i3.Request $getImage_Request({
  required String key,
  ThemingGetImageUseSvg? useSvg,
}) {
  final _parameters = <String, Object?>{};
  final $key = _$jsonSerializers.serialize(key, specifiedType: const FullType(String));
  _parameters['key'] = $key;

  var $useSvg = _$jsonSerializers.serialize(useSvg, specifiedType: const FullType(ThemingGetImageUseSvg));
  $useSvg ??= 1;
  _parameters['useSvg'] = $useSvg;

  final _path = _i4.UriTemplate('/index.php/apps/theming/image/{key}{?useSvg*}').expand(_parameters);
  final _uri = Uri.parse('${_rootClient.baseURL}$_path');
  final _request = _i3.Request('get', _uri);
  _request.headers['Accept'] = '*/*';
// coverage:ignore-start
  final authentication = _rootClient.authentications?.firstWhereOrNull(
    (auth) => switch (auth) {
      _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true,
      _ => false,
    },
  );

  if (authentication != null) {
    _request.headers.addAll(
      authentication.headers,
    );
  }

// coverage:ignore-end
  return _request;
}