getThemeStylesheetRaw method
Get the CSS stylesheet for a theme.
This method and the response it returns is experimental. The API might change without a major version bump.
Returns a Future containing a DynamiteRawResponse with the raw HttpClientResponse and serialization helpers. Throws a DynamiteApiException if the API call does not return an expected status code.
Parameters:
plain
Let the browser decide the CSS priority. Defaults to0
.withCustomCss
Include custom CSS. Defaults to0
.themeId
ID of the theme.
Status codes:
- 200: Stylesheet returned
- 404: Theme not found
See:
- getThemeStylesheet for an operation that returns a DynamiteResponse with a stable API.
Implementation
@experimental
DynamiteRawResponse<String, void> getThemeStylesheetRaw({
required String themeId,
int? plain,
int? withCustomCss,
}) {
final _parameters = <String, dynamic>{};
final _headers = <String, String>{
'Accept': 'text/css',
};
// coverage:ignore-start
final authentication = _rootClient.authentications.firstWhereOrNull(
(auth) => switch (auth) {
DynamiteHttpBearerAuthentication() || DynamiteHttpBasicAuthentication() => true,
_ => false,
},
);
if (authentication != null) {
_headers.addAll(
authentication.headers,
);
}
// coverage:ignore-end
final $themeId = jsonSerializers.serialize(themeId, specifiedType: const FullType(String));
_parameters['themeId'] = $themeId;
var $plain = jsonSerializers.serialize(plain, specifiedType: const FullType(int));
$plain ??= 0;
_parameters['plain'] = $plain;
var $withCustomCss = jsonSerializers.serialize(withCustomCss, specifiedType: const FullType(int));
$withCustomCss ??= 0;
_parameters['withCustomCss'] = $withCustomCss;
final _path =
UriTemplate('/index.php/apps/theming/theme/{themeId}.css{?plain*,withCustomCss*}').expand(_parameters);
return DynamiteRawResponse<String, void>(
response: _rootClient.executeRequest(
'get',
_path,
_headers,
null,
const {200},
),
bodyType: const FullType(String),
headersType: null,
serializers: jsonSerializers,
);
}