search_api.dart 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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' operation and returns the [Response].
  50. /// Parameters:
  51. ///
  52. /// * [String] q:
  53. ///
  54. /// * [String] query:
  55. ///
  56. /// * [bool] clip:
  57. ///
  58. /// * [String] type:
  59. ///
  60. /// * [bool] isFavorite:
  61. ///
  62. /// * [bool] isArchived:
  63. ///
  64. /// * [String] exifInfoPeriodCity:
  65. ///
  66. /// * [String] exifInfoPeriodState:
  67. ///
  68. /// * [String] exifInfoPeriodCountry:
  69. ///
  70. /// * [String] exifInfoPeriodMake:
  71. ///
  72. /// * [String] exifInfoPeriodModel:
  73. ///
  74. /// * [String] exifInfoPeriodProjectionType:
  75. ///
  76. /// * [List<String>] smartInfoPeriodObjects:
  77. ///
  78. /// * [List<String>] smartInfoPeriodTags:
  79. ///
  80. /// * [bool] recent:
  81. ///
  82. /// * [bool] motion:
  83. 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, String? exifInfoPeriodProjectionType, List<String>? smartInfoPeriodObjects, List<String>? smartInfoPeriodTags, bool? recent, bool? motion, }) async {
  84. // ignore: prefer_const_declarations
  85. final path = r'/search';
  86. // ignore: prefer_final_locals
  87. Object? postBody;
  88. final queryParams = <QueryParam>[];
  89. final headerParams = <String, String>{};
  90. final formParams = <String, String>{};
  91. if (q != null) {
  92. queryParams.addAll(_queryParams('', 'q', q));
  93. }
  94. if (query != null) {
  95. queryParams.addAll(_queryParams('', 'query', query));
  96. }
  97. if (clip != null) {
  98. queryParams.addAll(_queryParams('', 'clip', clip));
  99. }
  100. if (type != null) {
  101. queryParams.addAll(_queryParams('', 'type', type));
  102. }
  103. if (isFavorite != null) {
  104. queryParams.addAll(_queryParams('', 'isFavorite', isFavorite));
  105. }
  106. if (isArchived != null) {
  107. queryParams.addAll(_queryParams('', 'isArchived', isArchived));
  108. }
  109. if (exifInfoPeriodCity != null) {
  110. queryParams.addAll(_queryParams('', 'exifInfo.city', exifInfoPeriodCity));
  111. }
  112. if (exifInfoPeriodState != null) {
  113. queryParams.addAll(_queryParams('', 'exifInfo.state', exifInfoPeriodState));
  114. }
  115. if (exifInfoPeriodCountry != null) {
  116. queryParams.addAll(_queryParams('', 'exifInfo.country', exifInfoPeriodCountry));
  117. }
  118. if (exifInfoPeriodMake != null) {
  119. queryParams.addAll(_queryParams('', 'exifInfo.make', exifInfoPeriodMake));
  120. }
  121. if (exifInfoPeriodModel != null) {
  122. queryParams.addAll(_queryParams('', 'exifInfo.model', exifInfoPeriodModel));
  123. }
  124. if (exifInfoPeriodProjectionType != null) {
  125. queryParams.addAll(_queryParams('', 'exifInfo.projectionType', exifInfoPeriodProjectionType));
  126. }
  127. if (smartInfoPeriodObjects != null) {
  128. queryParams.addAll(_queryParams('multi', 'smartInfo.objects', smartInfoPeriodObjects));
  129. }
  130. if (smartInfoPeriodTags != null) {
  131. queryParams.addAll(_queryParams('multi', 'smartInfo.tags', smartInfoPeriodTags));
  132. }
  133. if (recent != null) {
  134. queryParams.addAll(_queryParams('', 'recent', recent));
  135. }
  136. if (motion != null) {
  137. queryParams.addAll(_queryParams('', 'motion', motion));
  138. }
  139. const contentTypes = <String>[];
  140. return apiClient.invokeAPI(
  141. path,
  142. 'GET',
  143. queryParams,
  144. postBody,
  145. headerParams,
  146. formParams,
  147. contentTypes.isEmpty ? null : contentTypes.first,
  148. );
  149. }
  150. /// Parameters:
  151. ///
  152. /// * [String] q:
  153. ///
  154. /// * [String] query:
  155. ///
  156. /// * [bool] clip:
  157. ///
  158. /// * [String] type:
  159. ///
  160. /// * [bool] isFavorite:
  161. ///
  162. /// * [bool] isArchived:
  163. ///
  164. /// * [String] exifInfoPeriodCity:
  165. ///
  166. /// * [String] exifInfoPeriodState:
  167. ///
  168. /// * [String] exifInfoPeriodCountry:
  169. ///
  170. /// * [String] exifInfoPeriodMake:
  171. ///
  172. /// * [String] exifInfoPeriodModel:
  173. ///
  174. /// * [String] exifInfoPeriodProjectionType:
  175. ///
  176. /// * [List<String>] smartInfoPeriodObjects:
  177. ///
  178. /// * [List<String>] smartInfoPeriodTags:
  179. ///
  180. /// * [bool] recent:
  181. ///
  182. /// * [bool] motion:
  183. 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, String? exifInfoPeriodProjectionType, List<String>? smartInfoPeriodObjects, List<String>? smartInfoPeriodTags, bool? recent, bool? motion, }) async {
  184. 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, exifInfoPeriodProjectionType: exifInfoPeriodProjectionType, smartInfoPeriodObjects: smartInfoPeriodObjects, smartInfoPeriodTags: smartInfoPeriodTags, recent: recent, motion: motion, );
  185. if (response.statusCode >= HttpStatus.badRequest) {
  186. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  187. }
  188. // When a remote server returns no body with a status of 204, we shall not decode it.
  189. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  190. // FormatException when trying to decode an empty string.
  191. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  192. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'SearchResponseDto',) as SearchResponseDto;
  193. }
  194. return null;
  195. }
  196. }