interfaces.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import * as URL from "./url";
  2. import * as Model from "./model";
  3. import { Code as ResCode } from "./code";
  4. type Appoint = { id: string };
  5. type Code = { sceneCode: string };
  6. type Page<T extends Array<any>> = {
  7. pageNum: number;
  8. pageSize: number;
  9. pages: number;
  10. total: number;
  11. list: T;
  12. };
  13. export type UN_DE_RES<M extends string = string, T = any> = {
  14. code: ResCode;
  15. msg: M;
  16. data?: T;
  17. };
  18. export type Interfaces = {
  19. GET: [
  20. {
  21. url: typeof URL.stylelist;
  22. paths: Code;
  23. response: Page<Array<Model.Style>>;
  24. },
  25. {
  26. url: typeof URL.hotlist;
  27. paths: Code;
  28. response: Page<
  29. Array<Omit<Model.Hot, "poiStyleId"> & { hotStyleAtom: Model.Style }>
  30. >;
  31. },
  32. {
  33. url: typeof URL.measureList;
  34. paths: Code;
  35. response: Page<Array<Model.Measure>>;
  36. },
  37. {
  38. url: typeof URL.setupInfo;
  39. paths: Code;
  40. response: UN_DE_RES<string, Model.SetupInfo>;
  41. },
  42. {
  43. url: typeof URL.inis;
  44. paths: Code;
  45. response: Model.Pose | undefined;
  46. }
  47. ];
  48. POST: [
  49. {
  50. url: typeof URL.addHot;
  51. paths: Code;
  52. data: Omit<Model.Hot, "id">;
  53. response: Model.Hot;
  54. },
  55. {
  56. url: typeof URL.addStyle;
  57. paths: Code;
  58. data: Omit<Model.Style, "id" | "is_default">;
  59. response: Model.Style;
  60. },
  61. {
  62. url: typeof URL.uploadFile;
  63. headers: {
  64. "Content-Type": "application/x-www-form-urlencoded;charset:UTF-8";
  65. };
  66. paths: Code & { type: string };
  67. data: Blob;
  68. response: string;
  69. },
  70. {
  71. url: typeof URL.addMeasure;
  72. paths: Code;
  73. data: Omit<Model.Measure, "id">;
  74. response: Model.Measure;
  75. },
  76. {
  77. url: typeof URL.addInis;
  78. paths: Code;
  79. data: Omit<Model.Pose, "id">;
  80. response: Model.Pose;
  81. },
  82. {
  83. url: typeof URL.updateHot;
  84. paths: Code;
  85. data: Model.Hot;
  86. },
  87. {
  88. url: typeof URL.updateMeasure;
  89. paths: Code;
  90. data: Model.Measure;
  91. },
  92. {
  93. url: typeof URL.updateSetupInfo;
  94. paths: Code;
  95. data: Model.SetupInfo;
  96. },
  97. {
  98. url: typeof URL.updateInis;
  99. paths: Code;
  100. data: Model.Pose;
  101. },
  102. {
  103. url: typeof URL.deleteHot;
  104. paths: Code & Appoint;
  105. },
  106. {
  107. url: typeof URL.deleteMeasure;
  108. paths: Code & Appoint;
  109. },
  110. {
  111. url: typeof URL.deleteStyle;
  112. paths: Code & Appoint;
  113. }
  114. ];
  115. PUT: [];
  116. DELETE: [];
  117. };
  118. export default Interfaces;