search_api.dart 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. //
  2. // AUTO-GENERATED FILE, DO NOT MODIFY!
  3. //
  4. // @dart=2.12
  5. // ignore_for_file: unused_element, unused_import
  6. // ignore_for_file: always_put_required_named_parameters_first
  7. // ignore_for_file: constant_identifier_names
  8. // ignore_for_file: lines_longer_than_80_chars
  9. part of openapi.api;
  10. class SearchApi {
  11. SearchApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
  12. final ApiClient apiClient;
  13. /// Performs an HTTP 'GET /search/explore' operation and returns the [Response].
  14. Future<Response> getExploreDataWithHttpInfo() async {
  15. // ignore: prefer_const_declarations
  16. final path = r'/search/explore';
  17. // ignore: prefer_final_locals
  18. Object? postBody;
  19. final queryParams = <QueryParam>[];
  20. final headerParams = <String, String>{};
  21. final formParams = <String, String>{};
  22. const contentTypes = <String>[];
  23. return apiClient.invokeAPI(
  24. path,
  25. 'GET',
  26. queryParams,
  27. postBody,
  28. headerParams,
  29. formParams,
  30. contentTypes.isEmpty ? null : contentTypes.first,
  31. );
  32. }
  33. Future<List<SearchExploreResponseDto>?> getExploreData() async {
  34. final response = await getExploreDataWithHttpInfo();
  35. if (response.statusCode >= HttpStatus.badRequest) {
  36. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  37. }
  38. // When a remote server returns no body with a status of 204, we shall not decode it.
  39. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  40. // FormatException when trying to decode an empty string.
  41. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  42. final responseBody = await _decodeBodyBytes(response);
  43. return (await apiClient.deserializeAsync(responseBody, 'List<SearchExploreResponseDto>') as List)
  44. .cast<SearchExploreResponseDto>()
  45. .toList();
  46. }
  47. return null;
  48. }
  49. /// Performs an HTTP 'GET /search/config' operation and returns the [Response].
  50. Future<Response> getSearchConfigWithHttpInfo() async {
  51. // ignore: prefer_const_declarations
  52. final path = r'/search/config';
  53. // ignore: prefer_final_locals
  54. Object? postBody;
  55. final queryParams = <QueryParam>[];
  56. final headerParams = <String, String>{};
  57. final formParams = <String, String>{};
  58. const contentTypes = <String>[];
  59. return apiClient.invokeAPI(
  60. path,
  61. 'GET',
  62. queryParams,
  63. postBody,
  64. headerParams,
  65. formParams,
  66. contentTypes.isEmpty ? null : contentTypes.first,
  67. );
  68. }
  69. Future<SearchConfigResponseDto?> getSearchConfig() async {
  70. final response = await getSearchConfigWithHttpInfo();
  71. if (response.statusCode >= HttpStatus.badRequest) {
  72. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  73. }
  74. // When a remote server returns no body with a status of 204, we shall not decode it.
  75. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  76. // FormatException when trying to decode an empty string.
  77. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  78. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'SearchConfigResponseDto',) as SearchConfigResponseDto;
  79. }
  80. return null;
  81. }
  82. /// Performs an HTTP 'GET /search' operation and returns the [Response].
  83. /// Parameters:
  84. ///
  85. /// * [String] q:
  86. ///
  87. /// * [String] query:
  88. ///
  89. /// * [bool] clip:
  90. ///
  91. /// * [String] type:
  92. ///
  93. /// * [bool] isFavorite:
  94. ///
  95. /// * [bool] isArchived:
  96. ///
  97. /// * [String] exifInfoPeriodCity:
  98. ///
  99. /// * [String] exifInfoPeriodState:
  100. ///
  101. /// * [String] exifInfoPeriodCountry:
  102. ///
  103. /// * [String] exifInfoPeriodMake:
  104. ///
  105. /// * [String] exifInfoPeriodModel:
  106. ///
  107. /// * [List<String>] smartInfoPeriodObjects:
  108. ///
  109. /// * [List<String>] smartInfoPeriodTags:
  110. ///
  111. /// * [bool] recent:
  112. ///
  113. /// * [bool] motion:
  114. Future<Response> searchWithHttpInfo({ String? q, String? query, bool? clip, String? type, bool? isFavorite, bool? isArchived, String? exifInfoPeriodCity, String? exifInfoPeriodState, String? exifInfoPeriodCountry, String? exifInfoPeriodMake, String? exifInfoPeriodModel, List<String>? smartInfoPeriodObjects, List<String>? smartInfoPeriodTags, bool? recent, bool? motion, }) async {
  115. // ignore: prefer_const_declarations
  116. final path = r'/search';
  117. // ignore: prefer_final_locals
  118. Object? postBody;
  119. final queryParams = <QueryParam>[];
  120. final headerParams = <String, String>{};
  121. final formParams = <String, String>{};
  122. if (q != null) {
  123. queryParams.addAll(_queryParams('', 'q', q));
  124. }
  125. if (query != null) {
  126. queryParams.addAll(_queryParams('', 'query', query));
  127. }
  128. if (clip != null) {
  129. queryParams.addAll(_queryParams('', 'clip', clip));
  130. }
  131. if (type != null) {
  132. queryParams.addAll(_queryParams('', 'type', type));
  133. }
  134. if (isFavorite != null) {
  135. queryParams.addAll(_queryParams('', 'isFavorite', isFavorite));
  136. }
  137. if (isArchived != null) {
  138. queryParams.addAll(_queryParams('', 'isArchived', isArchived));
  139. }
  140. if (exifInfoPeriodCity != null) {
  141. queryParams.addAll(_queryParams('', 'exifInfo.city', exifInfoPeriodCity));
  142. }
  143. if (exifInfoPeriodState != null) {
  144. queryParams.addAll(_queryParams('', 'exifInfo.state', exifInfoPeriodState));
  145. }
  146. if (exifInfoPeriodCountry != null) {
  147. queryParams.addAll(_queryParams('', 'exifInfo.country', exifInfoPeriodCountry));
  148. }
  149. if (exifInfoPeriodMake != null) {
  150. queryParams.addAll(_queryParams('', 'exifInfo.make', exifInfoPeriodMake));
  151. }
  152. if (exifInfoPeriodModel != null) {
  153. queryParams.addAll(_queryParams('', 'exifInfo.model', exifInfoPeriodModel));
  154. }
  155. if (smartInfoPeriodObjects != null) {
  156. queryParams.addAll(_queryParams('multi', 'smartInfo.objects', smartInfoPeriodObjects));
  157. }
  158. if (smartInfoPeriodTags != null) {
  159. queryParams.addAll(_queryParams('multi', 'smartInfo.tags', smartInfoPeriodTags));
  160. }
  161. if (recent != null) {
  162. queryParams.addAll(_queryParams('', 'recent', recent));
  163. }
  164. if (motion != null) {
  165. queryParams.addAll(_queryParams('', 'motion', motion));
  166. }
  167. const contentTypes = <String>[];
  168. return apiClient.invokeAPI(
  169. path,
  170. 'GET',
  171. queryParams,
  172. postBody,
  173. headerParams,
  174. formParams,
  175. contentTypes.isEmpty ? null : contentTypes.first,
  176. );
  177. }
  178. /// Parameters:
  179. ///
  180. /// * [String] q:
  181. ///
  182. /// * [String] query:
  183. ///
  184. /// * [bool] clip:
  185. ///
  186. /// * [String] type:
  187. ///
  188. /// * [bool] isFavorite:
  189. ///
  190. /// * [bool] isArchived:
  191. ///
  192. /// * [String] exifInfoPeriodCity:
  193. ///
  194. /// * [String] exifInfoPeriodState:
  195. ///
  196. /// * [String] exifInfoPeriodCountry:
  197. ///
  198. /// * [String] exifInfoPeriodMake:
  199. ///
  200. /// * [String] exifInfoPeriodModel:
  201. ///
  202. /// * [List<String>] smartInfoPeriodObjects:
  203. ///
  204. /// * [List<String>] smartInfoPeriodTags:
  205. ///
  206. /// * [bool] recent:
  207. ///
  208. /// * [bool] motion:
  209. Future<SearchResponseDto?> search({ String? q, String? query, bool? clip, String? type, bool? isFavorite, bool? isArchived, String? exifInfoPeriodCity, String? exifInfoPeriodState, String? exifInfoPeriodCountry, String? exifInfoPeriodMake, String? exifInfoPeriodModel, List<String>? smartInfoPeriodObjects, List<String>? smartInfoPeriodTags, bool? recent, bool? motion, }) async {
  210. final response = await searchWithHttpInfo( q: q, query: query, clip: clip, type: type, isFavorite: isFavorite, isArchived: isArchived, exifInfoPeriodCity: exifInfoPeriodCity, exifInfoPeriodState: exifInfoPeriodState, exifInfoPeriodCountry: exifInfoPeriodCountry, exifInfoPeriodMake: exifInfoPeriodMake, exifInfoPeriodModel: exifInfoPeriodModel, smartInfoPeriodObjects: smartInfoPeriodObjects, smartInfoPeriodTags: smartInfoPeriodTags, recent: recent, motion: motion, );
  211. if (response.statusCode >= HttpStatus.badRequest) {
  212. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  213. }
  214. // When a remote server returns no body with a status of 204, we shall not decode it.
  215. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  216. // FormatException when trying to decode an empty string.
  217. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  218. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'SearchResponseDto',) as SearchResponseDto;
  219. }
  220. return null;
  221. }
  222. }