$getThumbnail_Request method

  1. @experimental
Request $getThumbnail_Request({
  1. required int x,
  2. required int y,
  3. required String file,
})

Gets a thumbnail of the specified file.

Returns a DynamiteRequest backing the getThumbnail operation. Throws a DynamiteApiException if the API call does not return an expected status code.

Parameters:

  • x Width of the thumbnail.
  • y Height of the thumbnail.
  • file URL-encoded filename.

Status codes:

  • 200: Thumbnail returned
  • 400: Getting thumbnail is not possible
  • 404: File not found

See:

Implementation

@_i2.experimental
_i3.Request $getThumbnail_Request({
  required int x,
  required int y,
  required String file,
}) {
  final _parameters = <String, Object?>{};
  final __x = _$jsonSerializers.serialize(x, specifiedType: const FullType(int));
  _parameters['x'] = __x;

  final __y = _$jsonSerializers.serialize(y, specifiedType: const FullType(int));
  _parameters['y'] = __y;

  final __file = _$jsonSerializers.serialize(file, specifiedType: const FullType(String));
  _i4.checkString(
    __file,
    'file',
    pattern: RegExp(r'^.+$'),
  );
  _parameters['file'] = __file;

  final _path = _i5.UriTemplate('/index.php/apps/files/api/v1/thumbnail/{x}/{y}/{file}').expand(_parameters);
  final _uri = Uri.parse('${_rootClient.baseURL}$_path');
  final _request = _i3.Request('get', _uri);
  _request.headers['Accept'] = '*/*';
// coverage:ignore-start
  final authentication = _i6.IterableExtension(_rootClient.authentications)?.firstWhereOrNull(
    (auth) => switch (auth) {
      _i1.DynamiteHttpBearerAuthentication() || _i1.DynamiteHttpBasicAuthentication() => true,
      _ => false,
    },
  );

  if (authentication != null) {
    _request.headers.addAll(
      authentication.headers,
    );
  } else {
    throw Exception('Missing authentication for bearer_auth or basic_auth');
  }

// coverage:ignore-end
  return _request;
}