getPreview method
Get a preview for a shared file.
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:
fileFile in the share. Defaults to''.xWidth of the preview. Defaults to32.yHeight of the preview. Defaults to32.aWhether to not crop the preview. Defaults to0.tokenToken of the share.oCSAPIRequestRequired to be true for the API request to pass. Defaults totrue.
Status codes:
- 200: Preview returned
- 400: Getting preview is not possible
- 403: Getting preview is not allowed
- 404: Share or preview not found
See:
- getPreviewRaw for an experimental operation that returns a DynamiteRawResponse that can be serialized.
Implementation
Future<DynamiteResponse<Uint8List, void>> getPreview({
required String token,
String? file,
int? x,
int? y,
int? a,
bool? oCSAPIRequest,
}) async {
final rawResponse = getPreviewRaw(
token: token,
file: file,
x: x,
y: y,
a: a,
oCSAPIRequest: oCSAPIRequest,
);
return rawResponse.future;
}