$getThemeStylesheet_Request method
- @experimental
- required String themeId,
- ThemingGetThemeStylesheetPlain? plain,
- 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:
themeId
ID of the theme.plain
Let the browser decide the CSS priority. Defaults to0
.withCustomCss
Include custom CSS. Defaults to0
.
Status codes:
- 200: Stylesheet returned
- 404: Theme not found
See:
- getThemeStylesheet for a method executing this request and parsing the response.
- $getThemeStylesheet_Serializer for a converter to parse the
Response
from an executed this request.
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 = _i5.IterableExtension(_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;
}