storage.m.dart 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. import 'liveConsultation.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. }
  21. if (authorization != null) {
  22. map['Authorization'] = authorization;
  23. }
  24. return map;
  25. }
  26. }
  27. class StorageServiceSettingDTO {
  28. String? authorization;
  29. String? contentType;
  30. String? storageUrl;
  31. StorageServiceSettingDTO({
  32. this.authorization,
  33. this.contentType,
  34. this.storageUrl,
  35. });
  36. factory StorageServiceSettingDTO.fromJson(Map<String, dynamic> map) {
  37. return StorageServiceSettingDTO(
  38. authorization: map['Authorization'],
  39. contentType: map['ContentType'],
  40. storageUrl: map['StorageUrl'],
  41. );
  42. }
  43. Map<String, dynamic> toJson() {
  44. final map = Map<String, dynamic>();
  45. if (authorization != null) {
  46. map['Authorization'] = authorization;
  47. }
  48. if (contentType != null) {
  49. map['ContentType'] = contentType;
  50. }
  51. if (storageUrl != null) {
  52. map['StorageUrl'] = storageUrl;
  53. }
  54. return map;
  55. }
  56. }
  57. class FileServiceRequest extends TokenRequest{
  58. String? fileName;
  59. bool isRechristen;
  60. bool isUpgradePackage;
  61. List<DataItemDTO>? urlParams;
  62. List<DataItemDTO>? headerParams;
  63. String? requestMethod;
  64. FileServiceRequest({
  65. this.fileName,
  66. this.isRechristen = false,
  67. this.isUpgradePackage = false,
  68. this.urlParams,
  69. this.headerParams,
  70. this.requestMethod,
  71. String? token,
  72. }) : super(
  73. token: token,
  74. );
  75. factory FileServiceRequest.fromJson(Map<String, dynamic> map) {
  76. return FileServiceRequest(
  77. fileName: map['FileName'],
  78. isRechristen: map['IsRechristen'],
  79. isUpgradePackage: map['IsUpgradePackage'],
  80. urlParams: map['UrlParams'] != null ? (map['UrlParams'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  81. headerParams: map['HeaderParams'] != null ? (map['HeaderParams'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  82. requestMethod: map['RequestMethod'],
  83. token: map['Token'],
  84. );
  85. }
  86. Map<String, dynamic> toJson() {
  87. final map = super.toJson();
  88. if (fileName != null)
  89. map['FileName'] = fileName;
  90. map['IsRechristen'] = isRechristen;
  91. map['IsUpgradePackage'] = isUpgradePackage;
  92. if (urlParams != null)
  93. map['UrlParams'] = urlParams;
  94. if (headerParams != null)
  95. map['HeaderParams'] = headerParams;
  96. if (requestMethod != null)
  97. map['RequestMethod'] = requestMethod;
  98. return map;
  99. }
  100. }
  101. class CheckStorageRequest {
  102. String? fileName;
  103. CheckStorageRequest({
  104. this.fileName,
  105. });
  106. factory CheckStorageRequest.fromJson(Map<String, dynamic> map) {
  107. return CheckStorageRequest(
  108. fileName: map['FileName'],
  109. );
  110. }
  111. Map<String, dynamic> toJson() {
  112. final map = Map<String, dynamic>();
  113. if (fileName != null) {
  114. map['FileName'] = fileName;
  115. }
  116. return map;
  117. }
  118. }
  119. class CheckFileIsExistRequest {
  120. String? oriFileName;
  121. int fileSize;
  122. bool isNeedPartUpload;
  123. bool isUpgradePackage;
  124. CheckFileIsExistRequest({
  125. this.oriFileName,
  126. this.fileSize = 0,
  127. this.isNeedPartUpload = false,
  128. this.isUpgradePackage = false,
  129. });
  130. factory CheckFileIsExistRequest.fromJson(Map<String, dynamic> map) {
  131. return CheckFileIsExistRequest(
  132. oriFileName: map['OriFileName'],
  133. fileSize: map['FileSize'],
  134. isNeedPartUpload: map['IsNeedPartUpload'],
  135. isUpgradePackage: map['IsUpgradePackage'],
  136. );
  137. }
  138. Map<String, dynamic> toJson() {
  139. final map = Map<String, dynamic>();
  140. if (oriFileName != null) {
  141. map['OriFileName'] = oriFileName;
  142. }
  143. map['FileSize'] = fileSize;
  144. map['IsNeedPartUpload'] = isNeedPartUpload;
  145. map['IsUpgradePackage'] = isUpgradePackage;
  146. return map;
  147. }
  148. }
  149. class CopyToOtherNodeRequest extends TokenRequest{
  150. String? fileName;
  151. String? fileUrl;
  152. CopyToOtherNodeRequest({
  153. this.fileName,
  154. this.fileUrl,
  155. String? token,
  156. }) : super(
  157. token: token,
  158. );
  159. factory CopyToOtherNodeRequest.fromJson(Map<String, dynamic> map) {
  160. return CopyToOtherNodeRequest(
  161. fileName: map['FileName'],
  162. fileUrl: map['FileUrl'],
  163. token: map['Token'],
  164. );
  165. }
  166. Map<String, dynamic> toJson() {
  167. final map = super.toJson();
  168. if (fileName != null)
  169. map['FileName'] = fileName;
  170. if (fileUrl != null)
  171. map['FileUrl'] = fileUrl;
  172. return map;
  173. }
  174. }
  175. class UploadFileTransferRequest extends TokenRequest{
  176. String? sourceFilePath;
  177. bool isRechristen;
  178. bool isNeedPartUpload;
  179. bool isCopy;
  180. UploadFileTransferRequest({
  181. this.sourceFilePath,
  182. this.isRechristen = false,
  183. this.isNeedPartUpload = false,
  184. this.isCopy = false,
  185. String? token,
  186. }) : super(
  187. token: token,
  188. );
  189. factory UploadFileTransferRequest.fromJson(Map<String, dynamic> map) {
  190. return UploadFileTransferRequest(
  191. sourceFilePath: map['SourceFilePath'],
  192. isRechristen: map['IsRechristen'],
  193. isNeedPartUpload: map['IsNeedPartUpload'],
  194. isCopy: map['IsCopy'],
  195. token: map['Token'],
  196. );
  197. }
  198. Map<String, dynamic> toJson() {
  199. final map = super.toJson();
  200. if (sourceFilePath != null)
  201. map['SourceFilePath'] = sourceFilePath;
  202. map['IsRechristen'] = isRechristen;
  203. map['IsNeedPartUpload'] = isNeedPartUpload;
  204. map['IsCopy'] = isCopy;
  205. return map;
  206. }
  207. }