m8ty_client_bankdocuments
Package overview
Section titled “Package overview”m8ty_client_bankdocuments solves this by providing typed access to documents, categories, attachments, and read status, so apps can organize and surface bank communications in one place.
Bank Documents information service covers all the aspects of bank documents, attachments, and categories.
Before you start
Section titled “Before you start”Check the documentation of the m8ty_client_bankdocuments library to get an idea about the available models and their properties.
Import all needed libraries
Section titled “Import all needed libraries” import 'package:dio/dio.dart'; import 'package:m8ty_client_bankdocuments/m8ty_client_bankdocuments.dart'; import 'package:m8ty_client_common/m8ty_client_common.dart'; import 'package:built_collection/built_collection.dart';Client Setup
Section titled “Client Setup”final client = M8tyClientBankdocuments();client.setOAuthToken('ApiOAuth2', oauthToken);API Surface
Section titled “API Surface”BankDocumentsApi
Section titled “BankDocumentsApi”| Method | Description |
|---|---|
searchBankDocuments |
Get user bank documents |
getBankDocumentById |
Get bank document by id |
deleteBankDocuments |
Delete bank documents |
markDocumentsAsRead |
Mark bank documents as read by the user |
AttachmentsApi
Section titled “AttachmentsApi”| Method | Description |
|---|---|
getAttachmentById |
Get a specific document attachment by its identifier |
CategoriesApi
Section titled “CategoriesApi”| Method | Description |
|---|---|
getAllDocumentCategories |
Get all available bank-document categories |
How to perform different tasks
Section titled “How to perform different tasks”Here some examples how the dart client can be used
Search for unread payment documents
Section titled “Search for unread payment documents” final client = M8tyClientBankdocuments(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getBankDocumentsApi();
final searchBankDocumentsRequest = SearchBankDocumentsRequestModel((b) => b ..customerId = "123" ..categoryType = BankDocumentCategoryTypeModel.PAYMENT_CATEGORY ..readStatus = SearchBankDocumentsRequestModelReadStatusEnum.UNREAD, );
final Response<BankDocumentsPageModel> documents = await api.searchBankDocuments( searchBankDocumentsRequestModel: searchBankDocumentsRequest, page: 1, size: 100, );Fetch document by id
Section titled “Fetch document by id” final client = M8tyClientBankdocuments(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getBankDocumentsApi(); final Response<BankDocumentModel> document = await api.getBankDocumentById( bankDocumentId: "1234", );Get list of all categories
Section titled “Get list of all categories” final client = M8tyClientBankdocuments(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCategoriesApi(); final Response<BuiltList<DocumentCategoryModel>> categories = await api.getAllDocumentCategories();Get specific attachment
Section titled “Get specific attachment” final client = M8tyClientBankdocuments(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getAttachmentsApi();
try { final Response<Uint8List> attachment = await api.getAttachmentById( bankDocumentId: "123", attachmentId: "4567", );
File file = File("/temp/myfile"); await file.writeAsBytes(attachment.data!); } on DioException catch (e) { throw Exception( 'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}', ); }© m8ty GmbH 2023 · m8ty.eu
