search_api.dart 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. ///
  14. ///
  15. /// Note: This method returns the HTTP [Response].
  16. Future<Response> getExploreDataWithHttpInfo() async {
  17. // ignore: prefer_const_declarations
  18. final path = r'/search/explore';
  19. // ignore: prefer_final_locals
  20. Object? postBody;
  21. final queryParams = <QueryParam>[];
  22. final headerParams = <String, String>{};
  23. final formParams = <String, String>{};
  24. const contentTypes = <String>[];
  25. return apiClient.invokeAPI(
  26. path,
  27. 'GET',
  28. queryParams,
  29. postBody,
  30. headerParams,
  31. formParams,
  32. contentTypes.isEmpty ? null : contentTypes.first,
  33. );
  34. }
  35. ///
  36. Future<List<SearchExploreResponseDto>?> getExploreData() async {
  37. final response = await getExploreDataWithHttpInfo();
  38. if (response.statusCode >= HttpStatus.badRequest) {
  39. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  40. }
  41. // When a remote server returns no body with a status of 204, we shall not decode it.
  42. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  43. // FormatException when trying to decode an empty string.
  44. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  45. final responseBody = await _decodeBodyBytes(response);
  46. return (await apiClient.deserializeAsync(responseBody, 'List<SearchExploreResponseDto>') as List)
  47. .cast<SearchExploreResponseDto>()
  48. .toList();
  49. }
  50. return null;
  51. }
  52. ///
  53. ///
  54. /// Note: This method returns the HTTP [Response].
  55. Future<Response> getSearchConfigWithHttpInfo() async {
  56. // ignore: prefer_const_declarations
  57. final path = r'/search/config';
  58. // ignore: prefer_final_locals
  59. Object? postBody;
  60. final queryParams = <QueryParam>[];
  61. final headerParams = <String, String>{};
  62. final formParams = <String, String>{};
  63. const contentTypes = <String>[];
  64. return apiClient.invokeAPI(
  65. path,
  66. 'GET',
  67. queryParams,
  68. postBody,
  69. headerParams,
  70. formParams,
  71. contentTypes.isEmpty ? null : contentTypes.first,
  72. );
  73. }
  74. ///
  75. Future<SearchConfigResponseDto?> getSearchConfig() async {
  76. final response = await getSearchConfigWithHttpInfo();
  77. if (response.statusCode >= HttpStatus.badRequest) {
  78. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  79. }
  80. // When a remote server returns no body with a status of 204, we shall not decode it.
  81. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  82. // FormatException when trying to decode an empty string.
  83. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  84. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'SearchConfigResponseDto',) as SearchConfigResponseDto;
  85. }
  86. return null;
  87. }
  88. ///
  89. ///
  90. /// Note: This method returns the HTTP [Response].
  91. Future<Response> searchWithHttpInfo() async {
  92. // ignore: prefer_const_declarations
  93. final path = r'/search';
  94. // ignore: prefer_final_locals
  95. Object? postBody;
  96. final queryParams = <QueryParam>[];
  97. final headerParams = <String, String>{};
  98. final formParams = <String, String>{};
  99. const contentTypes = <String>[];
  100. return apiClient.invokeAPI(
  101. path,
  102. 'GET',
  103. queryParams,
  104. postBody,
  105. headerParams,
  106. formParams,
  107. contentTypes.isEmpty ? null : contentTypes.first,
  108. );
  109. }
  110. ///
  111. Future<SearchResponseDto?> search() async {
  112. final response = await searchWithHttpInfo();
  113. if (response.statusCode >= HttpStatus.badRequest) {
  114. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  115. }
  116. // When a remote server returns no body with a status of 204, we shall not decode it.
  117. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  118. // FormatException when trying to decode an empty string.
  119. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  120. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'SearchResponseDto',) as SearchResponseDto;
  121. }
  122. return null;
  123. }
  124. }