storage.m.dart 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. import 'aIDiagnosis.m.dart';
  2. class StorageRequest {
  3. List<int>? file;
  4. String? authorization;
  5. StorageRequest({
  6. this.file,
  7. this.authorization,
  8. });
  9. factory StorageRequest.fromJson(Map<String, dynamic> map) {
  10. final fileData = map['File'];
  11. return StorageRequest(
  12. file: fileData != null ? (fileData as List).map((e) => e as int).toList(): null,
  13. authorization: map['Authorization'],
  14. );
  15. }
  16. Map<String, dynamic> toJson() {
  17. final map = Map<String, dynamic>();
  18. if(file != null)
  19. map['File'] = file;
  20. if(authorization != null)
  21. map['Authorization'] = authorization;
  22. return map;
  23. }
  24. }
  25. class StorageServiceSettingDTO {
  26. String? authorization;
  27. String? contentType;
  28. String? storageUrl;
  29. StorageServiceSettingDTO({
  30. this.authorization,
  31. this.contentType,
  32. this.storageUrl,
  33. });
  34. factory StorageServiceSettingDTO.fromJson(Map<String, dynamic> map) {
  35. return StorageServiceSettingDTO(
  36. authorization: map['Authorization'],
  37. contentType: map['ContentType'],
  38. storageUrl: map['StorageUrl'],
  39. );
  40. }
  41. Map<String, dynamic> toJson() {
  42. final map = Map<String, dynamic>();
  43. if(authorization != null)
  44. map['Authorization'] = authorization;
  45. if(contentType != null)
  46. map['ContentType'] = contentType;
  47. if(storageUrl != null)
  48. map['StorageUrl'] = storageUrl;
  49. return map;
  50. }
  51. }
  52. enum UploadFileTypeEnum {
  53. Unknown,
  54. EXE,
  55. APK,
  56. IPA,
  57. ZIP,
  58. DAT,
  59. RAR,
  60. PNG,
  61. ICON,
  62. BMP,
  63. JPEG,
  64. JPG,
  65. GIF,
  66. WEBP,
  67. TIFF,
  68. IMG,
  69. PDF,
  70. DOC,
  71. DOCX,
  72. XLS,
  73. XLSX,
  74. MP4,
  75. MSI,
  76. VID,
  77. }
  78. enum ApplicantTypeEnum {
  79. Client,
  80. Device,
  81. Management,
  82. ThirdParty,
  83. Server,
  84. }
  85. class FileServiceRequest extends TokenRequest{
  86. String? fileName;
  87. UploadFileTypeEnum fileTypeEnum;
  88. ApplicantTypeEnum applicantTypeEnum;
  89. FileServiceRequest({
  90. this.fileName,
  91. this.fileTypeEnum = UploadFileTypeEnum.Unknown,
  92. this.applicantTypeEnum = ApplicantTypeEnum.Client,
  93. String? token,
  94. }) : super(
  95. token: token,
  96. );
  97. factory FileServiceRequest.fromJson(Map<String, dynamic> map) {
  98. return FileServiceRequest(
  99. fileName: map['FileName'],
  100. fileTypeEnum: UploadFileTypeEnum.values.firstWhere((e) => e.index == map['FileTypeEnum']),
  101. applicantTypeEnum: ApplicantTypeEnum.values.firstWhere((e) => e.index == map['ApplicantTypeEnum']),
  102. token: map['Token'],
  103. );
  104. }
  105. Map<String, dynamic> toJson() {
  106. final map = super.toJson();
  107. if(fileName != null)
  108. map['FileName'] = fileName;
  109. map['FileTypeEnum'] = fileTypeEnum.index;
  110. map['ApplicantTypeEnum'] = applicantTypeEnum.index;
  111. return map;
  112. }
  113. }