getPreview method

Future<DynamiteResponse<Uint8List, void>> getPreview({
  1. required String token,
  2. String? file,
  3. int? x,
  4. int? y,
  5. PublicPreviewGetPreviewA? a,
})

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:

  • file File in the share. Defaults to "".
  • x Width of the preview. Defaults to 32.
  • y Height of the preview. Defaults to 32.
  • a Whether to not crop the preview. Defaults to 0.
  • token Token of the share.

Status codes:

  • 200: Preview returned
  • 400: Getting preview is not possible
  • 403: Getting preview is not allowed
  • 404: Share or preview not found

See:

Implementation

Future<_i1.DynamiteResponse<Uint8List, void>> getPreview({
  required String token,
  String? file,
  int? x,
  int? y,
  PublicPreviewGetPreviewA? a,
}) async {
  final _request = $getPreview_Request(
    token: token,
    file: file,
    x: x,
    y: y,
    a: a,
  );
  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);
}