upgrade.m.dart 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. import 'notification.m.dart';
  2. import 'liveConsultation.m.dart';
  3. import 'organization.m.dart';
  4. class GetUpgradeInfoResult {
  5. UpgradeTypeEnum upgradeType;
  6. String? upgradeCDNUrl;
  7. String? upgradeSourceUrl;
  8. String? backUpCDNUrl;
  9. String? backUpSourceUrl;
  10. UpgradeUpdateTypeEnum upgradeUpdateType;
  11. String? newVersion;
  12. String? description;
  13. GetUpgradeInfoResult({
  14. this.upgradeType = UpgradeTypeEnum.NoUpgrade,
  15. this.upgradeCDNUrl,
  16. this.upgradeSourceUrl,
  17. this.backUpCDNUrl,
  18. this.backUpSourceUrl,
  19. this.upgradeUpdateType = UpgradeUpdateTypeEnum.Part,
  20. this.newVersion,
  21. this.description,
  22. });
  23. factory GetUpgradeInfoResult.fromJson(Map<String, dynamic> map) {
  24. return GetUpgradeInfoResult(
  25. upgradeType: UpgradeTypeEnum.values.firstWhere((e) => e.index == map['UpgradeType']),
  26. upgradeCDNUrl: map['UpgradeCDNUrl'],
  27. upgradeSourceUrl: map['UpgradeSourceUrl'],
  28. backUpCDNUrl: map['BackUpCDNUrl'],
  29. backUpSourceUrl: map['BackUpSourceUrl'],
  30. upgradeUpdateType: UpgradeUpdateTypeEnum.values.firstWhere((e) => e.index == map['UpgradeUpdateType']),
  31. newVersion: map['NewVersion'],
  32. description: map['Description'],
  33. );
  34. }
  35. Map<String, dynamic> toJson() {
  36. final map = Map<String, dynamic>();
  37. map['UpgradeType'] = upgradeType.index;
  38. if (upgradeCDNUrl != null) {
  39. map['UpgradeCDNUrl'] = upgradeCDNUrl;
  40. }
  41. if (upgradeSourceUrl != null) {
  42. map['UpgradeSourceUrl'] = upgradeSourceUrl;
  43. }
  44. if (backUpCDNUrl != null) {
  45. map['BackUpCDNUrl'] = backUpCDNUrl;
  46. }
  47. if (backUpSourceUrl != null) {
  48. map['BackUpSourceUrl'] = backUpSourceUrl;
  49. }
  50. map['UpgradeUpdateType'] = upgradeUpdateType.index;
  51. if (newVersion != null) {
  52. map['NewVersion'] = newVersion;
  53. }
  54. if (description != null) {
  55. map['Description'] = description;
  56. }
  57. return map;
  58. }
  59. }
  60. enum UpgradePlatformEnum {
  61. PC,
  62. Android,
  63. IOS,
  64. Mac,
  65. }
  66. enum UpgradeSourceTypeEnum {
  67. Client,
  68. US,
  69. SONOPOST,
  70. FISLib,
  71. }
  72. class GetUpgradeInfoRequest {
  73. UpgradePlatformEnum platform;
  74. UpgradeSourceTypeEnum sourceType;
  75. String? currentVersion;
  76. String? language;
  77. GetUpgradeInfoRequest({
  78. this.platform = UpgradePlatformEnum.PC,
  79. this.sourceType = UpgradeSourceTypeEnum.Client,
  80. this.currentVersion,
  81. this.language,
  82. });
  83. factory GetUpgradeInfoRequest.fromJson(Map<String, dynamic> map) {
  84. return GetUpgradeInfoRequest(
  85. platform: UpgradePlatformEnum.values.firstWhere((e) => e.index == map['Platform']),
  86. sourceType: UpgradeSourceTypeEnum.values.firstWhere((e) => e.index == map['SourceType']),
  87. currentVersion: map['CurrentVersion'],
  88. language: map['Language'],
  89. );
  90. }
  91. Map<String, dynamic> toJson() {
  92. final map = Map<String, dynamic>();
  93. map['Platform'] = platform.index;
  94. map['SourceType'] = sourceType.index;
  95. if (currentVersion != null) {
  96. map['CurrentVersion'] = currentVersion;
  97. }
  98. if (language != null) {
  99. map['Language'] = language;
  100. }
  101. return map;
  102. }
  103. }
  104. class SetUpgradeInfoRequest {
  105. UpgradePlatformEnum platform;
  106. UpgradeSourceTypeEnum sourceType;
  107. String? currentVersion;
  108. String? token;
  109. SetUpgradeInfoRequest({
  110. this.platform = UpgradePlatformEnum.PC,
  111. this.sourceType = UpgradeSourceTypeEnum.Client,
  112. this.currentVersion,
  113. this.token,
  114. });
  115. factory SetUpgradeInfoRequest.fromJson(Map<String, dynamic> map) {
  116. return SetUpgradeInfoRequest(
  117. platform: UpgradePlatformEnum.values.firstWhere((e) => e.index == map['Platform']),
  118. sourceType: UpgradeSourceTypeEnum.values.firstWhere((e) => e.index == map['SourceType']),
  119. currentVersion: map['CurrentVersion'],
  120. token: map['Token'],
  121. );
  122. }
  123. Map<String, dynamic> toJson() {
  124. final map = Map<String, dynamic>();
  125. map['Platform'] = platform.index;
  126. map['SourceType'] = sourceType.index;
  127. if (currentVersion != null) {
  128. map['CurrentVersion'] = currentVersion;
  129. }
  130. if (token != null) {
  131. map['Token'] = token;
  132. }
  133. return map;
  134. }
  135. }
  136. enum OrganizationQueryTypeEnum {
  137. Wait,
  138. Single,
  139. AllDep,
  140. All,
  141. }
  142. class GetUserListRequest extends TokenRequest{
  143. String? keyword;
  144. OrganizationQueryTypeEnum organizationQueryType;
  145. String? organizationCode;
  146. String? rankCode;
  147. String? positionCode;
  148. bool exceptSelf;
  149. String? language;
  150. List<String>? roleCodes;
  151. GetUserListRequest({
  152. this.keyword,
  153. this.organizationQueryType = OrganizationQueryTypeEnum.Wait,
  154. this.organizationCode,
  155. this.rankCode,
  156. this.positionCode,
  157. this.exceptSelf = false,
  158. this.language,
  159. this.roleCodes,
  160. String? token,
  161. }) : super(
  162. token: token,
  163. );
  164. factory GetUserListRequest.fromJson(Map<String, dynamic> map) {
  165. return GetUserListRequest(
  166. keyword: map['Keyword'],
  167. organizationQueryType: OrganizationQueryTypeEnum.values.firstWhere((e) => e.index == map['OrganizationQueryType']),
  168. organizationCode: map['OrganizationCode'],
  169. rankCode: map['RankCode'],
  170. positionCode: map['PositionCode'],
  171. exceptSelf: map['ExceptSelf'],
  172. language: map['Language'],
  173. roleCodes: map['RoleCodes']?.cast<String>().toList(),
  174. token: map['Token'],
  175. );
  176. }
  177. Map<String, dynamic> toJson() {
  178. final map = super.toJson();
  179. if (keyword != null)
  180. map['Keyword'] = keyword;
  181. map['OrganizationQueryType'] = organizationQueryType.index;
  182. if (organizationCode != null)
  183. map['OrganizationCode'] = organizationCode;
  184. if (rankCode != null)
  185. map['RankCode'] = rankCode;
  186. if (positionCode != null)
  187. map['PositionCode'] = positionCode;
  188. map['ExceptSelf'] = exceptSelf;
  189. if (language != null)
  190. map['Language'] = language;
  191. if (roleCodes != null)
  192. map['RoleCodes'] = roleCodes;
  193. return map;
  194. }
  195. }
  196. enum CurrentClientSourceTypeEnum {
  197. PC,
  198. Web,
  199. SONOPOST,
  200. FISLib,
  201. Android,
  202. }
  203. class GetFlyinsonoVersionRequest {
  204. CurrentClientSourceTypeEnum currentClientType;
  205. GetFlyinsonoVersionRequest({
  206. this.currentClientType = CurrentClientSourceTypeEnum.PC,
  207. });
  208. factory GetFlyinsonoVersionRequest.fromJson(Map<String, dynamic> map) {
  209. return GetFlyinsonoVersionRequest(
  210. currentClientType: CurrentClientSourceTypeEnum.values.firstWhere((e) => e.index == map['CurrentClientType']),
  211. );
  212. }
  213. Map<String, dynamic> toJson() {
  214. final map = Map<String, dynamic>();
  215. map['CurrentClientType'] = currentClientType.index;
  216. return map;
  217. }
  218. }