From 9791fb7d2342384a2cadd0d3e23f3a49ac6fcfcd Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 27 Jan 2023 23:47:48 +1100 Subject: [PATCH] Update plugin metadata endpoint (#251) * Update plugin metadata endpoint * Update release notes --- assets/release_notes.md | 1 + lib/inventree/model.dart | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/assets/release_notes.md b/assets/release_notes.md index e1aa0069..7c7b3a71 100644 --- a/assets/release_notes.md +++ b/assets/release_notes.md @@ -4,6 +4,7 @@ ### 0.10.0 - February 2023 --- +- Updates to match latest server API - Bug fix for empty HttpResponse from server ### 0.9.2 - December 2022 diff --git a/lib/inventree/model.dart b/lib/inventree/model.dart index 9ba2e8c1..e2fe9808 100644 --- a/lib/inventree/model.dart +++ b/lib/inventree/model.dart @@ -679,7 +679,19 @@ class InvenTreePlugin extends InvenTreeModel { } @override - String get URL => "plugin/"; + String get URL { + + /* Note: The plugin API endpoint changed at API version 90, + * < 90 = 'plugin' + * >= 90 = 'plugins' + * Ref: https://github.com/inventree/InvenTree/pull/4186 + */ + if (api.isConnected() && api.apiVersion < 90) { + return "plugin/"; + } else { + return "plugins/"; + } + } String get key => (jsondata["key"] ?? "") as String;