api.g.dart 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  1. // GENERATED CODE - DO NOT MODIFY BY HAND
  2. part of 'api.dart';
  3. // **************************************************************************
  4. // RetrofitGenerator
  5. // **************************************************************************
  6. // ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers
  7. class _Api implements Api {
  8. _Api(
  9. this._dio, {
  10. this.baseUrl,
  11. });
  12. final Dio _dio;
  13. String? baseUrl;
  14. @override
  15. Future<ApiRsp<LoginRsp>> login(LoginReq req) async {
  16. const _extra = <String, dynamic>{};
  17. final queryParameters = <String, dynamic>{};
  18. final _headers = <String, dynamic>{};
  19. final _data = <String, dynamic>{};
  20. _data.addAll(req.toJson());
  21. final _result = await _dio
  22. .fetch<Map<String, dynamic>>(_setStreamType<ApiRsp<LoginRsp>>(Options(
  23. method: 'POST',
  24. headers: _headers,
  25. extra: _extra,
  26. )
  27. .compose(
  28. _dio.options,
  29. '/admin-api/system/auth/login',
  30. queryParameters: queryParameters,
  31. data: _data,
  32. )
  33. .copyWith(
  34. baseUrl: _combineBaseUrls(
  35. _dio.options.baseUrl,
  36. baseUrl,
  37. ))));
  38. final value = ApiRsp<LoginRsp>.fromJson(
  39. _result.data!,
  40. (json) => LoginRsp.fromJson(json as Map<String, dynamic>),
  41. );
  42. return value;
  43. }
  44. @override
  45. Future<ApiRsp<UserRsp>> userProfile() async {
  46. const _extra = <String, dynamic>{};
  47. final queryParameters = <String, dynamic>{};
  48. final _headers = <String, dynamic>{};
  49. final Map<String, dynamic>? _data = null;
  50. final _result = await _dio
  51. .fetch<Map<String, dynamic>>(_setStreamType<ApiRsp<UserRsp>>(Options(
  52. method: 'GET',
  53. headers: _headers,
  54. extra: _extra,
  55. )
  56. .compose(
  57. _dio.options,
  58. '/admin-api/system/user/profile/get',
  59. queryParameters: queryParameters,
  60. data: _data,
  61. )
  62. .copyWith(
  63. baseUrl: _combineBaseUrls(
  64. _dio.options.baseUrl,
  65. baseUrl,
  66. ))));
  67. final value = ApiRsp<UserRsp>.fromJson(
  68. _result.data!,
  69. (json) => UserRsp.fromJson(json as Map<String, dynamic>),
  70. );
  71. return value;
  72. }
  73. @override
  74. Future<ApiRsp<bool>> updatePassword(Map<String, dynamic> map) async {
  75. const _extra = <String, dynamic>{};
  76. final queryParameters = <String, dynamic>{};
  77. final _headers = <String, dynamic>{};
  78. final _data = <String, dynamic>{};
  79. _data.addAll(map);
  80. final _result = await _dio
  81. .fetch<Map<String, dynamic>>(_setStreamType<ApiRsp<bool>>(Options(
  82. method: 'PUT',
  83. headers: _headers,
  84. extra: _extra,
  85. )
  86. .compose(
  87. _dio.options,
  88. '/admin-api/system/user/profile/update-password',
  89. queryParameters: queryParameters,
  90. data: _data,
  91. )
  92. .copyWith(
  93. baseUrl: _combineBaseUrls(
  94. _dio.options.baseUrl,
  95. baseUrl,
  96. ))));
  97. final value = ApiRsp<bool>.fromJson(
  98. _result.data!,
  99. (json) => json as bool,
  100. );
  101. return value;
  102. }
  103. @override
  104. Future<ApiRsp<List<storehouseRsp>>> getStoreMessage(
  105. String ajbm,
  106. String key,
  107. ) async {
  108. const _extra = <String, dynamic>{};
  109. final queryParameters = <String, dynamic>{
  110. r'ajbm': ajbm,
  111. r'key': key,
  112. };
  113. final _headers = <String, dynamic>{};
  114. final Map<String, dynamic>? _data = null;
  115. final _result = await _dio.fetch<Map<String, dynamic>>(
  116. _setStreamType<ApiRsp<List<storehouseRsp>>>(Options(
  117. method: 'GET',
  118. headers: _headers,
  119. extra: _extra,
  120. )
  121. .compose(
  122. _dio.options,
  123. '/admin-api/coding/fmxx/queryLsxxList',
  124. queryParameters: queryParameters,
  125. data: _data,
  126. )
  127. .copyWith(
  128. baseUrl: _combineBaseUrls(
  129. _dio.options.baseUrl,
  130. baseUrl,
  131. ))));
  132. final value = ApiRsp<List<storehouseRsp>>.fromJson(
  133. _result.data!,
  134. (json) => json is List<dynamic>
  135. ? json
  136. .map<storehouseRsp>(
  137. (i) => storehouseRsp.fromJson(i as Map<String, dynamic>))
  138. .toList()
  139. : List.empty(),
  140. );
  141. return value;
  142. }
  143. @override
  144. Future<ApiRsp<List<DictRsp>>> getAllDict() async {
  145. const _extra = <String, dynamic>{};
  146. final queryParameters = <String, dynamic>{};
  147. final _headers = <String, dynamic>{};
  148. final Map<String, dynamic>? _data = null;
  149. final _result = await _dio.fetch<Map<String, dynamic>>(
  150. _setStreamType<ApiRsp<List<DictRsp>>>(Options(
  151. method: 'GET',
  152. headers: _headers,
  153. extra: _extra,
  154. )
  155. .compose(
  156. _dio.options,
  157. '/admin-api/system/dict-data/simple-list',
  158. queryParameters: queryParameters,
  159. data: _data,
  160. )
  161. .copyWith(
  162. baseUrl: _combineBaseUrls(
  163. _dio.options.baseUrl,
  164. baseUrl,
  165. ))));
  166. final value = ApiRsp<List<DictRsp>>.fromJson(
  167. _result.data!,
  168. (json) => json is List<dynamic>
  169. ? json
  170. .map<DictRsp>((i) => DictRsp.fromJson(i as Map<String, dynamic>))
  171. .toList()
  172. : List.empty(),
  173. );
  174. return value;
  175. }
  176. @override
  177. Future<ApiRsp<SampleTaskListRsp>> sampleTaskList(
  178. Map<String, dynamic> map) async {
  179. const _extra = <String, dynamic>{};
  180. final queryParameters = <String, dynamic>{};
  181. queryParameters.addAll(map);
  182. final _headers = <String, dynamic>{};
  183. final Map<String, dynamic>? _data = null;
  184. final _result = await _dio.fetch<Map<String, dynamic>>(
  185. _setStreamType<ApiRsp<SampleTaskListRsp>>(Options(
  186. method: 'GET',
  187. headers: _headers,
  188. extra: _extra,
  189. )
  190. .compose(
  191. _dio.options,
  192. '/admin-api/zj/code-sampling-task-details-sgjc/sampling_task_detail_page',
  193. queryParameters: queryParameters,
  194. data: _data,
  195. )
  196. .copyWith(
  197. baseUrl: _combineBaseUrls(
  198. _dio.options.baseUrl,
  199. baseUrl,
  200. ))));
  201. final value = ApiRsp<SampleTaskListRsp>.fromJson(
  202. _result.data!,
  203. (json) => SampleTaskListRsp.fromJson(json as Map<String, dynamic>),
  204. );
  205. return value;
  206. }
  207. @override
  208. Future<ApiRsp<String?>> getAppDownloadUrl() async {
  209. const _extra = <String, dynamic>{};
  210. final queryParameters = <String, dynamic>{};
  211. final _headers = <String, dynamic>{};
  212. final Map<String, dynamic>? _data = null;
  213. final _result = await _dio
  214. .fetch<Map<String, dynamic>>(_setStreamType<ApiRsp<String>>(Options(
  215. method: 'GET',
  216. headers: _headers,
  217. extra: _extra,
  218. )
  219. .compose(
  220. _dio.options,
  221. '/admin-api/zj/base-file/getAppDownLoadUrl',
  222. queryParameters: queryParameters,
  223. data: _data,
  224. )
  225. .copyWith(
  226. baseUrl: _combineBaseUrls(
  227. _dio.options.baseUrl,
  228. baseUrl,
  229. ))));
  230. final value = ApiRsp<String?>.fromJson(
  231. _result.data!,
  232. (json) => json as String?,
  233. );
  234. return value;
  235. }
  236. @override
  237. Future<ApiRsp<bool?>> updateSampleTaskSgjc(Map<String, dynamic> map) async {
  238. const _extra = <String, dynamic>{};
  239. final queryParameters = <String, dynamic>{};
  240. final _headers = <String, dynamic>{};
  241. final _data = <String, dynamic>{};
  242. _data.addAll(map);
  243. final _result = await _dio
  244. .fetch<Map<String, dynamic>>(_setStreamType<ApiRsp<bool>>(Options(
  245. method: 'PUT',
  246. headers: _headers,
  247. extra: _extra,
  248. )
  249. .compose(
  250. _dio.options,
  251. '/admin-api/zj/code-sampling-task-details-sgjc/update',
  252. queryParameters: queryParameters,
  253. data: _data,
  254. )
  255. .copyWith(
  256. baseUrl: _combineBaseUrls(
  257. _dio.options.baseUrl,
  258. baseUrl,
  259. ))));
  260. final value = ApiRsp<bool?>.fromJson(
  261. _result.data!,
  262. (json) => json as bool?,
  263. );
  264. return value;
  265. }
  266. @override
  267. Future<ApiRsp<bool?>> updateSampleTaskKcjc(Map<String, dynamic> map) async {
  268. const _extra = <String, dynamic>{};
  269. final queryParameters = <String, dynamic>{};
  270. final _headers = <String, dynamic>{};
  271. final _data = <String, dynamic>{};
  272. _data.addAll(map);
  273. final _result = await _dio
  274. .fetch<Map<String, dynamic>>(_setStreamType<ApiRsp<bool>>(Options(
  275. method: 'PUT',
  276. headers: _headers,
  277. extra: _extra,
  278. )
  279. .compose(
  280. _dio.options,
  281. '/admin-api/zj/code-sampling-task-details-kcjc/update',
  282. queryParameters: queryParameters,
  283. data: _data,
  284. )
  285. .copyWith(
  286. baseUrl: _combineBaseUrls(
  287. _dio.options.baseUrl,
  288. baseUrl,
  289. ))));
  290. final value = ApiRsp<bool?>.fromJson(
  291. _result.data!,
  292. (json) => json as bool?,
  293. );
  294. return value;
  295. }
  296. @override
  297. Future<ApiRsp<SampleTaskItem?>> sampleTaskDetailSgjc(num id) async {
  298. const _extra = <String, dynamic>{};
  299. final queryParameters = <String, dynamic>{r'id': id};
  300. final _headers = <String, dynamic>{};
  301. final Map<String, dynamic>? _data = null;
  302. final _result = await _dio.fetch<Map<String, dynamic>>(
  303. _setStreamType<ApiRsp<SampleTaskItem>>(Options(
  304. method: 'GET',
  305. headers: _headers,
  306. extra: _extra,
  307. )
  308. .compose(
  309. _dio.options,
  310. '/admin-api/zj/code-sampling-task-details-sgjc/getSamplingTaskDetails',
  311. queryParameters: queryParameters,
  312. data: _data,
  313. )
  314. .copyWith(
  315. baseUrl: _combineBaseUrls(
  316. _dio.options.baseUrl,
  317. baseUrl,
  318. ))));
  319. final value = ApiRsp<SampleTaskItem?>.fromJson(
  320. _result.data!,
  321. (json) => json == null
  322. ? null
  323. : SampleTaskItem.fromJson(json as Map<String, dynamic>),
  324. );
  325. return value;
  326. }
  327. @override
  328. Future<ApiRsp<SampleTaskItemKcjcRsp?>> sampleTaskDetailKcjc(num id) async {
  329. const _extra = <String, dynamic>{};
  330. final queryParameters = <String, dynamic>{r'id': id};
  331. final _headers = <String, dynamic>{};
  332. final Map<String, dynamic>? _data = null;
  333. final _result = await _dio.fetch<Map<String, dynamic>>(
  334. _setStreamType<ApiRsp<SampleTaskItemKcjcRsp>>(Options(
  335. method: 'GET',
  336. headers: _headers,
  337. extra: _extra,
  338. )
  339. .compose(
  340. _dio.options,
  341. '/admin-api/zj/code-sampling-task-details-kcjc/get',
  342. queryParameters: queryParameters,
  343. data: _data,
  344. )
  345. .copyWith(
  346. baseUrl: _combineBaseUrls(
  347. _dio.options.baseUrl,
  348. baseUrl,
  349. ))));
  350. final value = ApiRsp<SampleTaskItemKcjcRsp?>.fromJson(
  351. _result.data!,
  352. (json) => json == null
  353. ? null
  354. : SampleTaskItemKcjcRsp.fromJson(json as Map<String, dynamic>),
  355. );
  356. return value;
  357. }
  358. @override
  359. Future<ApiRsp<List<TrxxRsp>?>> trxxList() async {
  360. const _extra = <String, dynamic>{};
  361. final queryParameters = <String, dynamic>{};
  362. final _headers = <String, dynamic>{};
  363. final Map<String, dynamic>? _data = null;
  364. final _result = await _dio.fetch<Map<String, dynamic>>(
  365. _setStreamType<ApiRsp<List<TrxxRsp>>>(Options(
  366. method: 'GET',
  367. headers: _headers,
  368. extra: _extra,
  369. )
  370. .compose(
  371. _dio.options,
  372. '/admin-api/zj/base-soil-information/trxxxz',
  373. queryParameters: queryParameters,
  374. data: _data,
  375. )
  376. .copyWith(
  377. baseUrl: _combineBaseUrls(
  378. _dio.options.baseUrl,
  379. baseUrl,
  380. ))));
  381. final value = ApiRsp<List<TrxxRsp>>.fromJson(
  382. _result.data!,
  383. (json) => json is List<dynamic>
  384. ? json
  385. .map<TrxxRsp>((i) => TrxxRsp.fromJson(i as Map<String, dynamic>))
  386. .toList()
  387. : List.empty(),
  388. );
  389. return value;
  390. }
  391. @override
  392. Future<ApiRsp<List<LsxxRsp>?>> lsxxList(String zlmc) async {
  393. const _extra = <String, dynamic>{};
  394. final queryParameters = <String, dynamic>{r'zlmc': zlmc};
  395. final _headers = <String, dynamic>{};
  396. final Map<String, dynamic>? _data = null;
  397. final _result = await _dio.fetch<Map<String, dynamic>>(
  398. _setStreamType<ApiRsp<List<LsxxRsp>>>(Options(
  399. method: 'GET',
  400. headers: _headers,
  401. extra: _extra,
  402. )
  403. .compose(
  404. _dio.options,
  405. '/admin-api/zj/base-grain-information/lsxxfl',
  406. queryParameters: queryParameters,
  407. data: _data,
  408. )
  409. .copyWith(
  410. baseUrl: _combineBaseUrls(
  411. _dio.options.baseUrl,
  412. baseUrl,
  413. ))));
  414. final value = ApiRsp<List<LsxxRsp>>.fromJson(
  415. _result.data!,
  416. (json) => json is List<dynamic>
  417. ? json
  418. .map<LsxxRsp>((i) => LsxxRsp.fromJson(i as Map<String, dynamic>))
  419. .toList()
  420. : List.empty(),
  421. );
  422. return value;
  423. }
  424. @override
  425. Future<ApiRsp<num?>> receiveSampleTaskSgjc(num id) async {
  426. const _extra = <String, dynamic>{};
  427. final queryParameters = <String, dynamic>{r'id': id};
  428. final _headers = <String, dynamic>{};
  429. final Map<String, dynamic>? _data = null;
  430. final _result = await _dio
  431. .fetch<Map<String, dynamic>>(_setStreamType<ApiRsp<num>>(Options(
  432. method: 'GET',
  433. headers: _headers,
  434. extra: _extra,
  435. )
  436. .compose(
  437. _dio.options,
  438. '/admin-api/zj/code-sampling-task-details-sgjc/updateStatus',
  439. queryParameters: queryParameters,
  440. data: _data,
  441. )
  442. .copyWith(
  443. baseUrl: _combineBaseUrls(
  444. _dio.options.baseUrl,
  445. baseUrl,
  446. ))));
  447. final value = ApiRsp<num?>.fromJson(
  448. _result.data!,
  449. (json) => json as num?,
  450. );
  451. return value;
  452. }
  453. @override
  454. Future<ApiRsp<List<PersonRsp>?>> getPersonMenu(num jhcyjg) async {
  455. const _extra = <String, dynamic>{};
  456. final queryParameters = <String, dynamic>{r'jhcyjg': jhcyjg};
  457. final _headers = <String, dynamic>{};
  458. final Map<String, dynamic>? _data = null;
  459. final _result = await _dio.fetch<Map<String, dynamic>>(
  460. _setStreamType<ApiRsp<List<PersonRsp>>>(Options(
  461. method: 'GET',
  462. headers: _headers,
  463. extra: _extra,
  464. )
  465. .compose(
  466. _dio.options,
  467. '/admin-api/zj/base-personnel/selectByJhcyjg',
  468. queryParameters: queryParameters,
  469. data: _data,
  470. )
  471. .copyWith(
  472. baseUrl: _combineBaseUrls(
  473. _dio.options.baseUrl,
  474. baseUrl,
  475. ))));
  476. final value = ApiRsp<List<PersonRsp>>.fromJson(
  477. _result.data!,
  478. (json) => json is List<dynamic>
  479. ? json
  480. .map<PersonRsp>(
  481. (i) => PersonRsp.fromJson(i as Map<String, dynamic>))
  482. .toList()
  483. : List.empty(),
  484. );
  485. return value;
  486. }
  487. @override
  488. Future<ApiRsp<List<DistrictRsp>?>> districtList(
  489. num uLevel, {
  490. num? id,
  491. }) async {
  492. const _extra = <String, dynamic>{};
  493. final queryParameters = <String, dynamic>{
  494. r'uLevel': uLevel,
  495. r'id': id,
  496. };
  497. queryParameters.removeWhere((k, v) => v == null);
  498. final _headers = <String, dynamic>{};
  499. final Map<String, dynamic>? _data = null;
  500. final _result = await _dio.fetch<Map<String, dynamic>>(
  501. _setStreamType<ApiRsp<List<DistrictRsp>>>(Options(
  502. method: 'GET',
  503. headers: _headers,
  504. extra: _extra,
  505. )
  506. .compose(
  507. _dio.options,
  508. '/admin-api/zj/base-administrative-division/list',
  509. queryParameters: queryParameters,
  510. data: _data,
  511. )
  512. .copyWith(
  513. baseUrl: _combineBaseUrls(
  514. _dio.options.baseUrl,
  515. baseUrl,
  516. ))));
  517. final value = ApiRsp<List<DistrictRsp>>.fromJson(
  518. _result.data!,
  519. (json) => json is List<dynamic>
  520. ? json
  521. .map<DistrictRsp>(
  522. (i) => DistrictRsp.fromJson(i as Map<String, dynamic>))
  523. .toList()
  524. : List.empty(),
  525. );
  526. return value;
  527. }
  528. @override
  529. Future<ApiRsp<String?>> upload(File file) async {
  530. const _extra = <String, dynamic>{};
  531. final queryParameters = <String, dynamic>{};
  532. final _headers = <String, dynamic>{};
  533. final _data = FormData();
  534. _data.files.add(MapEntry(
  535. 'file',
  536. MultipartFile.fromFileSync(
  537. file.path,
  538. filename: file.path.split(Platform.pathSeparator).last,
  539. ),
  540. ));
  541. final _result = await _dio
  542. .fetch<Map<String, dynamic>>(_setStreamType<ApiRsp<String>>(Options(
  543. method: 'POST',
  544. headers: _headers,
  545. extra: _extra,
  546. )
  547. .compose(
  548. _dio.options,
  549. '/admin-api/infra/file/upload',
  550. queryParameters: queryParameters,
  551. data: _data,
  552. )
  553. .copyWith(
  554. baseUrl: _combineBaseUrls(
  555. _dio.options.baseUrl,
  556. baseUrl,
  557. ))));
  558. final value = ApiRsp<String?>.fromJson(
  559. _result.data!,
  560. (json) => json as String?,
  561. );
  562. return value;
  563. }
  564. @override
  565. Future<ApiRsp<dynamic>> postDeviceInfos(List<DeviceReq> req) async {
  566. const _extra = <String, dynamic>{};
  567. final queryParameters = <String, dynamic>{};
  568. final _headers = <String, dynamic>{};
  569. final _data = req.map((e) => e.toJson()).toList();
  570. final _result = await _dio
  571. .fetch<Map<String, dynamic>>(_setStreamType<ApiRsp<dynamic>>(Options(
  572. method: 'POST',
  573. headers: _headers,
  574. extra: _extra,
  575. )
  576. .compose(
  577. _dio.options,
  578. '/admin-api/zj/base-device/createBatch',
  579. queryParameters: queryParameters,
  580. data: _data,
  581. )
  582. .copyWith(
  583. baseUrl: _combineBaseUrls(
  584. _dio.options.baseUrl,
  585. baseUrl,
  586. ))));
  587. final value = ApiRsp<dynamic>.fromJson(
  588. _result.data!,
  589. (json) => json as dynamic,
  590. );
  591. return value;
  592. }
  593. @override
  594. Future<ApiRsp<bool?>> postPhoneMsg(Map<String, dynamic> map) async {
  595. const _extra = <String, dynamic>{};
  596. final queryParameters = <String, dynamic>{};
  597. final _headers = <String, dynamic>{};
  598. final _data = <String, dynamic>{};
  599. _data.addAll(map);
  600. final _result = await _dio
  601. .fetch<Map<String, dynamic>>(_setStreamType<ApiRsp<bool>>(Options(
  602. method: 'POST',
  603. headers: _headers,
  604. extra: _extra,
  605. )
  606. .compose(
  607. _dio.options,
  608. '/admin-api/system/auth/reset_password_send_sms_code',
  609. queryParameters: queryParameters,
  610. data: _data,
  611. )
  612. .copyWith(
  613. baseUrl: _combineBaseUrls(
  614. _dio.options.baseUrl,
  615. baseUrl,
  616. ))));
  617. final value = ApiRsp<bool?>.fromJson(
  618. _result.data!,
  619. (json) => json as bool?,
  620. );
  621. return value;
  622. }
  623. @override
  624. Future<ApiRsp<bool?>> resetPassword(Map<String, dynamic> map) async {
  625. const _extra = <String, dynamic>{};
  626. final queryParameters = <String, dynamic>{};
  627. final _headers = <String, dynamic>{};
  628. final _data = <String, dynamic>{};
  629. _data.addAll(map);
  630. final _result = await _dio
  631. .fetch<Map<String, dynamic>>(_setStreamType<ApiRsp<bool>>(Options(
  632. method: 'POST',
  633. headers: _headers,
  634. extra: _extra,
  635. )
  636. .compose(
  637. _dio.options,
  638. '/admin-api/system/auth/reset_password',
  639. queryParameters: queryParameters,
  640. data: _data,
  641. )
  642. .copyWith(
  643. baseUrl: _combineBaseUrls(
  644. _dio.options.baseUrl,
  645. baseUrl,
  646. ))));
  647. final value = ApiRsp<bool?>.fromJson(
  648. _result.data!,
  649. (json) => json as bool?,
  650. );
  651. return value;
  652. }
  653. RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
  654. if (T != dynamic &&
  655. !(requestOptions.responseType == ResponseType.bytes ||
  656. requestOptions.responseType == ResponseType.stream)) {
  657. if (T == String) {
  658. requestOptions.responseType = ResponseType.plain;
  659. } else {
  660. requestOptions.responseType = ResponseType.json;
  661. }
  662. }
  663. return requestOptions;
  664. }
  665. String _combineBaseUrls(
  666. String dioBaseUrl,
  667. String? baseUrl,
  668. ) {
  669. if (baseUrl == null || baseUrl.trim().isEmpty) {
  670. return dioBaseUrl;
  671. }
  672. final url = Uri.parse(baseUrl);
  673. if (url.isAbsolute) {
  674. return url.toString();
  675. }
  676. return Uri.parse(dioBaseUrl).resolveUri(url).toString();
  677. }
  678. }