create method

Future<CreateTransferResult> create(
  1. List<TransferFileInput> files, {
  2. CreateTransferOptions options = const CreateTransferOptions(),
})

Create a new transfer (server-side upload). Files must be PUT to the returned presigned URLs to complete the upload.

Implementation

Future<CreateTransferResult> create(
  List<TransferFileInput> files, {
  CreateTransferOptions options = const CreateTransferOptions(),
}) async {
  final body = <String, dynamic>{
    'files': files.map((f) => f.toJson()).toList(),
    ...options.toJson(),
  };
  final raw = (await _http.request('POST', '/transfers', body: body))
      as Map<String, dynamic>;
  return CreateTransferResult.fromJson(raw);
}