ranking-api.tsx 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import { request } from '../../../utils';
  2. import { API } from '../../../types';
  3. import { ResponseType } from '../response-type';
  4. export interface PostGetRanking extends ResponseType {
  5. data: {
  6. user_id: number;
  7. score_dare: number;
  8. score_nm: number;
  9. score_un: number;
  10. score_unp: number;
  11. score_tcc: number;
  12. score_deep: number;
  13. score_whs: number;
  14. score_kye: number;
  15. score_tbt: number;
  16. score_yes: number;
  17. score_slow: number;
  18. rank_tbt: number;
  19. avatar: string;
  20. first_name: string;
  21. last_name: string;
  22. age: number;
  23. flag1: string;
  24. flag2: string;
  25. badge_1281: number;
  26. badge_un: number;
  27. badge_un_25: 0 | 1;
  28. badge_un_50: 0 | 1;
  29. badge_un_75: 0 | 1;
  30. badge_un_100: 0 | 1;
  31. badge_un_150: 0 | 1;
  32. badge_un_193: 0 | 1;
  33. badge_supreme: number;
  34. badge_tbt: number;
  35. badge_offline: number;
  36. patreon: number;
  37. country: string;
  38. auth: number;
  39. rank: number;
  40. country_rank: number;
  41. dod: number;
  42. ukr: number;
  43. badges: number;
  44. arrow_nm: number;
  45. arrow_un: number;
  46. arrow_unp: number;
  47. arrow_dare: number;
  48. arrow_yes: number;
  49. arrow_whs: number;
  50. arrow_tcc: number;
  51. arrow_tbt: number;
  52. arrow_slow: number;
  53. arrow_kye: number;
  54. }[];
  55. }
  56. export interface PostGetUNTypes extends ResponseType {
  57. data: {
  58. type: number;
  59. name: string;
  60. }[];
  61. }
  62. export interface Masters {
  63. id: number;
  64. type: number;
  65. origin: string;
  66. origin1: string;
  67. origin2: string;
  68. full_name: string;
  69. tbt_username: string;
  70. born: string;
  71. final: string | null;
  72. final_year: string;
  73. final_country: string;
  74. age: string;
  75. personal: string;
  76. media: string;
  77. media2: string;
  78. media3: string;
  79. wikipedia: string;
  80. book: string;
  81. book_url: string;
  82. book2: string;
  83. book_url2: string;
  84. social: string;
  85. twitter: string;
  86. instagram: string;
  87. youtube: string;
  88. status: number;
  89. sort: number;
  90. last_country: string;
  91. user_id: number | null;
  92. origin1_flag: string;
  93. origin2_flag: string | null;
  94. final_flag: string;
  95. interviews: string[];
  96. }
  97. export interface YearUNType extends ResponseType {
  98. data: {
  99. year: number;
  100. masters: Masters[];
  101. }[];
  102. }
  103. export interface CountryUNType extends ResponseType {
  104. data: {
  105. country: string;
  106. code: string;
  107. masters: Masters[];
  108. flag: string;
  109. }[];
  110. }
  111. export interface PostGetUNType extends ResponseType {
  112. data: {
  113. data: Masters[];
  114. start: number;
  115. };
  116. }
  117. export interface PostGetCountriesRanking extends ResponseType {
  118. data: { two: string; name: string }[];
  119. }
  120. export const rankingApi = {
  121. getLimitedRanking: () => request.postForm<PostGetRanking>(API.GET_LIMITED_RANKING),
  122. getFullRanking: () => request.postForm<PostGetRanking>(API.GET_FULL_RANKING),
  123. getLpi: () => request.postForm<PostGetRanking>(API.GET_LPI),
  124. getInHistory: () => request.postForm<PostGetRanking>(API.GET_IN_HISTORY),
  125. getInMemoriam: () => request.postForm<PostGetRanking>(API.GET_IN_MEMORIAM),
  126. getUNMastersTypes: () => request.postForm<PostGetUNTypes>(API.GET_UN_MASTERS_TYPES),
  127. getUNMastersType: (type: number) =>
  128. request.postForm<PostGetUNType>(API.GET_UN_MASTERS_TYPE, { type }),
  129. getCountriesRanking: () => request.get<PostGetCountriesRanking>(API.GET_COUNTRIES_RANKING),
  130. getCountriesRankingLPI: () => request.get<PostGetCountriesRanking>(API.GET_COUNTRIES_RANKING_LPI),
  131. getCountriesRankingMemoriam: () =>
  132. request.get<PostGetCountriesRanking>(API.GET_COUNTRIES_RANKING_MEMORIAM)
  133. };