getPreview method
Future<DynamiteResponse<Uint8List, void> >
getPreview({
- String? file,
- int? x,
- int? y,
- PreviewGetPreviewA? a,
- PreviewGetPreviewForceIcon? forceIcon,
- String? mode,
- PreviewGetPreviewMimeFallback? mimeFallback,
Get a preview by file path.
Returns a Future containing a DynamiteResponse with the status code, deserialized body and headers.
Throws a DynamiteApiException if the API call does not return an expected status code.
Parameters:
filePath of the file. Defaults to"".xWidth of the preview. Defaults to32.yHeight of the preview. Defaults to32.aWhether to not crop the preview. Defaults to0.forceIconForce returning an icon. Defaults to1.modeHow to crop the image. Defaults to"fill".mimeFallbackWhether to fallback to the mime icon if no preview is available. Defaults to0.
Status codes:
- 200: Preview returned
- 400: Getting preview is not possible
- 403: Getting preview is not allowed
- 404: Preview not found
- 303: Redirect to the mime icon url if mimeFallback is true
See:
- $getPreview_Request for the request send by this method.
- $getPreview_Serializer for a converter to parse the
Responsefrom an executed request.
Implementation
Future<_i1.DynamiteResponse<Uint8List, void>> getPreview({
String? file,
int? x,
int? y,
PreviewGetPreviewA? a,
PreviewGetPreviewForceIcon? forceIcon,
String? mode,
PreviewGetPreviewMimeFallback? mimeFallback,
}) async {
final _request = $getPreview_Request(
file: file,
x: x,
y: y,
a: a,
forceIcon: forceIcon,
mode: mode,
mimeFallback: mimeFallback,
);
final _response = await _rootClient.httpClient.send(_request);
final _serializer = $getPreview_Serializer();
final _rawResponse = await _i1.ResponseConverter<Uint8List, void>(_serializer).convert(_response);
return _i1.DynamiteResponse.fromRawResponse(_rawResponse);
}