$getThemeStylesheet_Request method

  1. @experimental
Request $getThemeStylesheet_Request({
  1. required String themeId,
  2. ThemingGetThemeStylesheetPlain? plain,
  3. ThemingGetThemeStylesheetWithCustomCss? withCustomCss,
})

Get the CSS stylesheet for a theme.

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

Parameters:

  • plain Let the browser decide the CSS priority. Defaults to 0.
  • withCustomCss Include custom CSS. Defaults to 0.
  • themeId ID of the theme.

Status codes:

  • 200: Stylesheet returned
  • 404: Theme not found

See:

Implementation

@_i2.experimental
_i3.Request $getThemeStylesheet_Request({
  required String themeId,
  ThemingGetThemeStylesheetPlain? plain,
  ThemingGetThemeStylesheetWithCustomCss? withCustomCss,
}) {
  final _parameters = <String, Object?>{};
  final $themeId = _$jsonSerializers.serialize(themeId, specifiedType: const FullType(String));
  _parameters['themeId'] = $themeId;

  var $plain = _$jsonSerializers.serialize(plain, specifiedType: const FullType(ThemingGetThemeStylesheetPlain));
  $plain ??= 0;
  _parameters['plain'] = $plain;

  var $withCustomCss = _$jsonSerializers.serialize(
    withCustomCss,
    specifiedType: const FullType(ThemingGetThemeStylesheetWithCustomCss),
  );
  $withCustomCss ??= 0;
  _parameters['withCustomCss'] = $withCustomCss;

  final _path =
      _i4.UriTemplate('/index.php/apps/theming/theme/{themeId}.css{?plain*,withCustomCss*}').expand(_parameters);
  final _uri = Uri.parse('${_rootClient.baseURL}$_path');
  final _request = _i3.Request('get', _uri);
  _request.headers['Accept'] = 'text/css';
// 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;
}