Skip to content

Commit

Permalink
fix: 927 - minimum forced query version is now 2 (#936)
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurtanuki authored Jun 7, 2024
1 parent 0fa5941 commit 260e482
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/src/utils/product_query_configurations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@ import 'abstract_query_configuration.dart';
import 'http_helper.dart';
import 'uri_helper.dart';

/// Api version for product queries
/// Api version for product queries (minimum forced version number: 2).
class ProductQueryVersion {
const ProductQueryVersion(this.version);
const ProductQueryVersion(final int version)
: version = version < 2 ? 2 : version;

final int version;

static const ProductQueryVersion v3 = ProductQueryVersion(3);

String getPath(final String barcode) {
if (version == 0) {
return '/api/v0/product/$barcode.json';
}
return '/api/v$version/product/$barcode/';
}
String getPath(final String barcode) => '/api/v$version/product/$barcode/';

bool matchesV3() => version >= 3;
}
Expand Down

0 comments on commit 260e482

Please sign in to comment.