Help Instance Help

m8ty_client_files

It's a security risk to have multiple endpoint to manage file uploads. The mitigate this issue this API has been created.

Before you start

Check the documentation of the m8ty_client_files library to get an idea about the available models and their properties.

import all needed libraries

import 'package:dio/dio.dart'; import 'package:m8ty_client_files/m8ty_client_files.dart'; import 'package:m8ty_client_common/m8ty_client_common.dart'; import 'package:built_collection/built_collection.dart';

How to perform different tasks

Here some examples how the dart client can be used

Upload a file

final client = M8tyClientFiles(); client.setOAuthToken('ApiOAuth2', oauthToken); final api = client.getFilesApi(); try { final response = await api.uploadFile( file: MultipartFile.fromFile('path/to/file.pdf', filename: 'file.pdf'), ); print('Uploaded: ${response.data}'); } on DioException catch (e) { throw Exception( 'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}', ); }

Download a file

final client = M8tyClientFiles(); client.setOAuthToken('ApiOAuth2', oauthToken); final api = client.getFilesApi(); final Response<Uint8List> response = await api.downloadFile( fileId: '1234', ); File file = File("/temp/myfile"); await file.writeAsBytes(response.data!);

List all files

final client = M8tyClientFiles(); client.setOAuthToken('ApiOAuth2', oauthToken); final api = client.getFilesApi(); final response = await api.listFiles();

Delete a file

final client = M8tyClientFiles(); client.setOAuthToken('ApiOAuth2', oauthToken); final api = client.getFilesApi(); await api.deleteFile( fileId: '1234', );

View a file

final client = M8tyClientFiles(); client.setOAuthToken('ApiOAuth2', oauthToken); final api = client.getFilesApi(); final response = await api.viewFile( fileId: '1234', );
03 June 2026