-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1222 from atsign-foundation/enroll_list_client_2
feat: add new method to fetch enrollment requests
- Loading branch information
Showing
12 changed files
with
251 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/at_client/lib/src/util/enroll_list_request_param.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/// class to store request parameters while fetching a list of enrollments | ||
class EnrollListRequestParam { | ||
String? appName; | ||
String? deviceName; | ||
String? namespace; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'dart:collection'; | ||
import 'dart:convert'; | ||
|
||
class EnrollmentRequest { | ||
late String enrollmentKey; | ||
late String appName; | ||
late String deviceName; | ||
late Map<String, dynamic> namespace; | ||
|
||
String get enrollmentId { | ||
return extractEnrollmentId(enrollmentKey); | ||
} | ||
|
||
@override | ||
String toString() { | ||
return 'Enrollment Request: enrollmentKey: $enrollmentKey | appName: $appName | deviceName: $deviceName | namespace: ${namespace.toString()}'; | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> jsonMap = HashMap(); | ||
jsonMap['enrollmentKey'] = enrollmentKey; | ||
jsonMap['appName'] = appName; | ||
jsonMap['deviceName'] = deviceName; | ||
jsonMap['namespace'] = jsonEncode(namespace); | ||
|
||
return jsonMap; | ||
} | ||
|
||
static EnrollmentRequest fromJson(Map<String, dynamic> json) { | ||
EnrollmentRequest enrollmentRequest = EnrollmentRequest(); | ||
return enrollmentRequest | ||
..appName = json['appName'] | ||
..deviceName = json['deviceName'] | ||
..namespace = json['namespace']; | ||
} | ||
|
||
static String extractEnrollmentId(String enrollmentKey) { | ||
return enrollmentKey.split('.')[0]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters