Update code from macAddress to Minor (for BeaconId).

This commit is contained in:
Fransolet Thomas 2023-02-20 14:46:06 +01:00
parent ebf9cabcb1
commit 4f346a1641
7 changed files with 24 additions and 39 deletions

View File

@ -1,7 +1,7 @@
import 'package:manager_api/api.dart';
class BeaconSection {
String? macAddress;
int? minorBeaconId;
String? configurationId;
String? sectionId;
/*int? rssi;
@ -9,11 +9,11 @@ class BeaconSection {
String? proximityUUID;*/
bool? found = false;
BeaconSection({this.macAddress, this.configurationId, this.sectionId, this.found});
BeaconSection({this.minorBeaconId, this.configurationId, this.sectionId, this.found});
Map<String, dynamic> toMap() {
return {
'macAddress': macAddress,
'minorBeaconId': minorBeaconId,
'configurationId': configurationId,
'sectionId': sectionId,
/*'rssi': rssi,
@ -25,7 +25,7 @@ class BeaconSection {
factory BeaconSection.fromJson(Map<String, dynamic> json) {
return BeaconSection(
macAddress: json['macAddress'] as String,
minorBeaconId: json['minorBeaconId'] as int,
configurationId: json['configurationId'] as String,
sectionId: json['sectionId'] as String,
/*rssi: json['rssi'] as int,
@ -37,6 +37,6 @@ class BeaconSection {
@override
String toString() {
return 'BeaconSection{macAddress: $macAddress, sectionId: $sectionId, configurationId: $configurationId, found: $found}';
return 'BeaconSection{minorBeaconId: $minorBeaconId, sectionId: $sectionId, configurationId: $configurationId, found: $found}';
}
}

View File

@ -136,7 +136,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
if(visitAppContext.beaconSections == null) {
List<SectionDTO>? sections = await ApiService.getAllBeacons(client, visitAppContext.instanceId!);
if(sections != null && sections.isNotEmpty) {
List<BeaconSection> beaconSections = sections.map((e) => BeaconSection(macAddress: e.beaconId, configurationId: e.configurationId, sectionId: e.id)).toList();
List<BeaconSection> beaconSections = sections.map((e) => BeaconSection(minorBeaconId: e.beaconId, configurationId: e.configurationId, sectionId: e.id)).toList();
visitAppContext.beaconSections = beaconSections;
print("Got some Beacons for you");
print(beaconSections);

View File

@ -165,9 +165,9 @@ class _VisitPageState extends State<VisitPage> with WidgetsBindingObserver {
if(result.beacons.isNotEmpty) {
print(result);
print(result.beacons.map((b) => b.macAddress));
print(visitAppContext.beaconSections!.map((bb) => bb!.macAddress));
print(visitAppContext.beaconSections!.map((bb) => bb!.minorBeaconId));
var beaconList = visitAppContext.beaconSections!.where((bs) => result.beacons.any((element) => element.macAddress == bs!.macAddress && element.accuracy < meterToBeacon));
var beaconList = visitAppContext.beaconSections!.where((bs) => result.beacons.any((element) => element.minor == bs!.minorBeaconId && element.accuracy < meterToBeacon));
if(beaconList.isNotEmpty) {
// FILTER CONFIG

View File

@ -1211,24 +1211,19 @@ paths:
type: string
security:
- bearer: []
/api/Section/beacons/{id}:
/api/Section/beacons/{instanceId}:
get:
tags:
- Section
operationId: Section_GetAllBeaconsForInstance
parameters:
- name: instanceId
in: query
schema:
type: string
nullable: true
x-position: 1
- name: id
in: path
required: true
schema:
type: string
x-position: 2
nullable: true
x-position: 1
responses:
'200':
description: ''

View File

@ -95,7 +95,7 @@ Class | Method | HTTP request | Description
*SectionApi* | [**sectionDelete**](doc\/SectionApi.md#sectiondelete) | **DELETE** /api/Section/{id} |
*SectionApi* | [**sectionDeleteAllForConfiguration**](doc\/SectionApi.md#sectiondeleteallforconfiguration) | **DELETE** /api/Section/configuration/{id} |
*SectionApi* | [**sectionGet**](doc\/SectionApi.md#sectionget) | **GET** /api/Section |
*SectionApi* | [**sectionGetAllBeaconsForInstance**](doc\/SectionApi.md#sectiongetallbeaconsforinstance) | **GET** /api/Section/beacons/{id} |
*SectionApi* | [**sectionGetAllBeaconsForInstance**](doc\/SectionApi.md#sectiongetallbeaconsforinstance) | **GET** /api/Section/beacons/{instanceId} |
*SectionApi* | [**sectionGetAllSectionSubSections**](doc\/SectionApi.md#sectiongetallsectionsubsections) | **GET** /api/Section/{id}/subsections |
*SectionApi* | [**sectionGetArticleDTO**](doc\/SectionApi.md#sectiongetarticledto) | **GET** /api/Section/ArticleDTO |
*SectionApi* | [**sectionGetDetail**](doc\/SectionApi.md#sectiongetdetail) | **GET** /api/Section/{id} |

View File

@ -13,7 +13,7 @@ Method | HTTP request | Description
[**sectionDelete**](SectionApi.md#sectiondelete) | **DELETE** /api/Section/{id} |
[**sectionDeleteAllForConfiguration**](SectionApi.md#sectiondeleteallforconfiguration) | **DELETE** /api/Section/configuration/{id} |
[**sectionGet**](SectionApi.md#sectionget) | **GET** /api/Section |
[**sectionGetAllBeaconsForInstance**](SectionApi.md#sectiongetallbeaconsforinstance) | **GET** /api/Section/beacons/{id} |
[**sectionGetAllBeaconsForInstance**](SectionApi.md#sectiongetallbeaconsforinstance) | **GET** /api/Section/beacons/{instanceId} |
[**sectionGetAllSectionSubSections**](SectionApi.md#sectiongetallsectionsubsections) | **GET** /api/Section/{id}/subsections |
[**sectionGetArticleDTO**](SectionApi.md#sectiongetarticledto) | **GET** /api/Section/ArticleDTO |
[**sectionGetDetail**](SectionApi.md#sectiongetdetail) | **GET** /api/Section/{id} |
@ -202,7 +202,7 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **sectionGetAllBeaconsForInstance**
> List<SectionDTO> sectionGetAllBeaconsForInstance(id, instanceId)
> List<SectionDTO> sectionGetAllBeaconsForInstance(instanceId)
@ -213,11 +213,10 @@ import 'package:manager_api/api.dart';
//defaultApiClient.getAuthentication<OAuth>('bearer').accessToken = 'YOUR_ACCESS_TOKEN';
final api_instance = SectionApi();
final id = id_example; // String |
final instanceId = instanceId_example; // String |
try {
final result = api_instance.sectionGetAllBeaconsForInstance(id, instanceId);
final result = api_instance.sectionGetAllBeaconsForInstance(instanceId);
print(result);
} catch (e) {
print('Exception when calling SectionApi->sectionGetAllBeaconsForInstance: $e\n');
@ -228,8 +227,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **String**| |
**instanceId** | **String**| | [optional]
**instanceId** | **String**| |
### Return type

View File

@ -213,16 +213,14 @@ class SectionApi {
return null;
}
/// Performs an HTTP 'GET /api/Section/beacons/{id}' operation and returns the [Response].
/// Performs an HTTP 'GET /api/Section/beacons/{instanceId}' operation and returns the [Response].
/// Parameters:
///
/// * [String] id (required):
///
/// * [String] instanceId:
Future<Response> sectionGetAllBeaconsForInstanceWithHttpInfo(String id, { String? instanceId, }) async {
/// * [String] instanceId (required):
Future<Response> sectionGetAllBeaconsForInstanceWithHttpInfo(String instanceId,) async {
// ignore: prefer_const_declarations
final path = r'/api/Section/beacons/{id}'
.replaceAll('{id}', id);
final path = r'/api/Section/beacons/{instanceId}'
.replaceAll('{instanceId}', instanceId);
// ignore: prefer_final_locals
Object? postBody;
@ -231,10 +229,6 @@ class SectionApi {
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (instanceId != null) {
queryParams.addAll(_queryParams('', 'instanceId', instanceId));
}
const contentTypes = <String>[];
@ -251,11 +245,9 @@ class SectionApi {
/// Parameters:
///
/// * [String] id (required):
///
/// * [String] instanceId:
Future<List<SectionDTO>?> sectionGetAllBeaconsForInstance(String id, { String? instanceId, }) async {
final response = await sectionGetAllBeaconsForInstanceWithHttpInfo(id, instanceId: instanceId, );
/// * [String] instanceId (required):
Future<List<SectionDTO>?> sectionGetAllBeaconsForInstance(String instanceId,) async {
final response = await sectionGetAllBeaconsForInstanceWithHttpInfo(instanceId,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}