2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 10:45:29 +00:00

Add support for company attachments (#261)

* Add support for company attachments

- Add API version check
- Add new class
- Add link to company detail page
- Assorted refactoring

* linting fixes
This commit is contained in:
Oliver
2023-02-16 22:50:32 +11:00
committed by GitHub
parent c7527e8b4e
commit 9485d858eb
8 changed files with 102 additions and 35 deletions

View File

@ -258,17 +258,26 @@ class InvenTreeAPI {
int get apiVersion => _apiVersion;
// API endpoint for receiving purchase order line items was introduced in v12
bool get supportsPoReceive => apiVersion >= 12;
// Notification support requires API v25 or newer
bool get supportsNotifications => isConnected() && apiVersion >= 25;
// Return True if the API supports 'settings' (requires API v46)
bool get supportsSettings => isConnected() && apiVersion >= 46;
// Part parameter support requires API v56 or newer
bool get supportsPartParameters => isConnected() && apiVersion >= 56;
// Supports 'modern' barcode API (v80 or newer)
bool get supportModernBarcodes => isConnected() && apiVersion >= 80;
// Structural categories requires API v83 or newer
bool get supportsStructuralCategories => isConnected() && apiVersion >= 83;
// Part parameter support requires API v56 or newer
bool get supportsPartParameters => isConnected() && apiVersion >= 56;
// Company attachments require API v95 or newer
bool get supportCompanyAttachments => isConnected() && apiVersion >= 95;
// Are plugins enabled on the server?
bool _pluginsEnabled = false;
@ -322,9 +331,6 @@ class InvenTreeAPI {
// Ensure we only ever create a single instance of the API class
static final InvenTreeAPI _api = InvenTreeAPI._internal();
// API endpoint for receiving purchase order line items was introduced in v12
bool get supportsPoReceive => apiVersion >= 12;
/*
* Connect to the remote InvenTree server:
*
@ -1280,9 +1286,6 @@ class InvenTreeAPI {
);
}
// Return True if the API supports 'settings' (requires API v46)
bool get supportsSettings => isConnected() && apiVersion >= 46;
// Keep a record of which settings we have received from the server
Map<String, InvenTreeGlobalSetting> _globalSettings = {};
Map<String, InvenTreeUserSetting> _userSettings = {};